mardi 23 mars 2021

Python else: SyntaxError: Invalid Syntax

I'm not sure at all why I keep getting this message no matter what i do. I've tried in 3 different plateforms. This is just the last half of the code.

Line 65 Else: ^ SyntaxError: Invalid Syntax

    preceed = input("Do you wish to continue? (Yes/No)\n") 
    if preceed.lower() in ['y', 'yes']:

    # Citizen Check
    citizen = input('Are you a U.S. Citizen? (Yes/No)\n') 
    if citizen.lower() in ['y', 'yes']:
    preceed = input("Do you wish to continue? (Yes/No)\n") 
    if preceed.lower() in ['y', 'yes']:

    # State Check
    state = input('Which State do you live in? ex. AL, CA, IL, ect... \n')
    if state.lower() in ['al', 'ak', 'az', 'ar', 'ca', 'co', 'ct', 'de', 'dc',   'fl', 'ga', 'hi', 'id',      'il', 'in', 'ia', 'ks', 'ky', 'la','me', 'md',   'ma','mi', 'mn', 'ms', 'mo', 'mt', 'ne', 'nv', 'nh', 'nj', 'nm','ny', 'nc', 'nd',   'oh', 'ok', 'or', 'pa', 'pr', 'ri', 'sc', 'sd', 'tn', 'tx','ut', 'vt', 'va', 'wa',   'wv', 'wi', 'wy']:

    preceed = input("Do you wish to continue? (Yes/No)\n")
    if preceed.lower() in ['y', 'yes']:
  
     # Zip Code
     zipCode = int(input("Please enter Zipcode\n"))
     while zipCode <= 9999 or zipCode >= 100000:
        if zipCode <= 9999:
            print('Please enter vaild ZipCode')
            zipCodeTryAgain = int(input('Please enter Zipcode\n'))
            zipCode = zipCodeTryAgain
        elif zipCode >= 100000:
            print('Please enter vaild ZipCode')
            zipCodeTryAgain = int(input('Please enter Zipcode\n'))
            zipCode = zipCodeTryAgain

        print('Thank you for registering to Vote.\n Here is the information you     have entered.')
        print('Name (First Last): ' + firstName + " " + lastName)
        print('Age: ' + str(age))
        print('U.S. Citizen: Yes')
        print('State: ' + state)
        print('Zipcode: ' + str(zipCode)) 
        print('Thank you for trying the Voter Registration Application.\nYour registration card     should be shipped within 3 weeks')

       else: 
           exit()

       else:
           print('Please enter vaild state next time')

       else:
           exit()

      else:
          print('Sorry you can not vote')

else: 
    exit()

Aucun commentaire:

Enregistrer un commentaire