Error on the below prog

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.

can you clarify if this is something you are doing for an fCC challenge? And what is the link to the challenge you are doing?

1 Like

No, this is not challenge, I am attending CS50P course working on a problem sets, This one of the problems on their course.

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.

1 Like

Oh sorry, I don’t know about that.

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.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

the links to their support pages are in the left-hand-side menu you see here

(scroll down to see them)

1 Like

Thank you so much. Sure I will look into that.