Jul-22-2019, 02:58 PM
(This post was last modified: Jul-22-2019, 03:00 PM by jefsummers.)
You are trying to do too many things at once. Although you will get the skills to combine some of these processes, I strongly suggest you tackle the requirements one at a time, like this...
def main(): enterstr = input("Enter String: ") valid_string = True """ First test - is the length exactly 9 """ if len(enterstr) != 9 : """ Print the error message and change the flag""" """ Will leave the first letter check to you Next must contain 7 digits """ digit_count = 0 for index in range(0,8): if enterstr[index].isdigit(): digit_count += 1 """Now check to see if the digit count passes, print error if not, adjust the flag. """You can write the rest from here """ main()