-4

So here is my coding for my questionnaire so far. On the 6th line how would I make it print invalid if the user enters a random set of characters that is not 1234?

 print ("Welcome, Please enter your Canadian Armed Forces Identification Number")
 answer = raw_input()
 if answer == ("1234"):
     print " Please identify yourself "
 elif answer == "":
     print " Invalid ID "
     print " 3 More attempts before termination of program "
 name= raw_input()

 if answer == ("Silva"):
     print " Welcome, Silva "
user247702
  • 23,641
  • 15
  • 110
  • 157
  • How would I make it repeat until the correct number is right? And if the user enters it wrong 3 more times how will i make the program terminate? – user3662856 May 21 '14 at 23:04
  • Those are two different questions. I suggest you pick up a book that teaches you all the basics. – user247702 May 21 '14 at 23:05

1 Answers1

0
if answer == ("1234"):
    print " Please identify yourself "
else:
    print " Invalid ID "
    print " 3 More attempts before termination of program " name= raw_input()
JakeSidSmith
  • 819
  • 6
  • 12