answer = raw_input(" guess a lucky number between 0 - 9 :") while answer!='5': print ("Guess the number again !") answer = raw_input("guess a lucky number between 0 - 9 :") else: print "The answer is correct" print "Which city is capital of spain" counter = 1 while counter <= 5: city = raw_input("The Guess no " + str(counter) + " is ") if city != 'madrid': print "Good Try But try again, its not correct" else: print "Good guess! at your %d chance" % counter break counter = counter +1 else: print "Game over your chances ended"
A Simple while loop program in python
Hi everyone today I have tried while condition to excercise on conditional statements . here are some of the programs I have tried.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment