0

このコードの while ループをage18 の場合にのみ機能するように修正し、それよりも小さい場合はエラー メッセージを出力し、間違った郵便番号の後でもプログラムを続行するにはどうすればよいですか?

これが私のコードです:

print "VOTER ELIGIBILITY AND POLLING STATION PROGRAM"
print
print
age= int(raw_input("Enter your age (Type ' 0 ' to exit program) :"))
while age != 18:
    print "ineligible"
    age= int(raw_input("Enter your age (Type ' 0 ' to exit program) :"))
    if age != 0:
        zipcode= int(raw_input("Enter your residence's zip code:"))

        if zipcode == 93305:
            print "Your polling station is 123 Panorama Drive."
        elif zipcode == 93306:
            print "Your polling station is 6143 Fairfax Drive."
        elif zipcode ==93307:
            print "Your polling station is 21121 B Street."
        elif zipcode ==93308:
            print "Your polling station is 863 Desmond Ct."
        elif zipcode == 93309:
            print "Your polling station is 7332 Del Canto Ct."
        else:
            print "Error-unknown zip code"

raw_input("\nRun complete.Press the Enter key to exit.")    
4

1 に答える 1