def main():
plate = input("Plate: ")
if is_valid(plate):
print("Valid")
else:
print("Invalid")
def is_valid(s):
for c in s:
if c in ["!",".","?",' ']:
return False
middle = s[len(s)//2]
if s[:2].isnumeric() or middle == '0':
return False
elif len(s)-1 > 6 or len(s)-1 < 2:
return False
elif middle.isnumeric() and s[-1].isalpha():
return False
else:
return True
Here if i gave input PI3.14 its should return Invalid but its shows is valid, I dont know what went wrong help please.
ah okay. Did you know that CS50 has a reddit and many support channels for their exercises? You can still ask here for help but as I am also taking CS50X I know that I always got help on the CS50 forums for the specific questions they have.
You will need to post the link to the CS50P lab or problem set if you hope to find someone here to give you feedback.
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.