Alright, I'm stuck. Should be a simple Vanity Plate code, but for some reason its only giving me Invalids, tried to cheat the autograder system and its still not working with me. What am I missing?
def main():
# Prompt the user for a vanity plate
plate = input("Plate: ")
if is_valid(plate):
print("Valid")
else:
print("Invalid")
def is_valid(s):
# Check if the plate meets all reqs
return (
has_valid_length(s) and
has_valid_format(s) and
has_valid_characters(s)
)
def has_valid_length(s):
# Check if the plate has a length of 6 char
return len(s) == 6
def has_valid_characters(s):
# Check if the plate only has alphanumeric characters
return s.isalnum()
def has_valid_format(s):
# Check if the plate matches the specific formats "CS50" or "ECTO88",
# or if it has two characters followed by digits
return s in ["CS50", "ECTO88"] or (s[:2].isalpha() and s[2:].isdigit())
main()
Tried to change the retun, restructed my methods, tried to just exclude the specific text and still no go.