-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 "
2
  • 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? Commented May 21, 2014 at 23:04
  • Those are two different questions. I suggest you pick up a book that teaches you all the basics. Commented May 21, 2014 at 23:05

1 Answer 1

0
if answer == ("1234"):
    print " Please identify yourself "
else:
    print " Invalid ID "
    print " 3 More attempts before termination of program " name= raw_input()
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.