mardi 24 mai 2016

How do I send the prompt backwards in my code in python?

I wrote a simple number guessing game with the randomint function.

Lets say I wrote it and it looked a little like this:

 import blah
 import blah

 print ("Hello, and welcome to the guesser")

 Answer1 = (randomint(1,5))
 Guess1 = int(input("Input a number 1-5")

 if Guess1 == Answer1:
      print ("You got lucky that time")

 elif Guess1 < 6 and != Answer1:
      #send back to guess again

 elif Guess1 > 5:
      print ("Invalid Number")
      #send back to guess again

It's probably a really stupid question and beginner stuff, but, is there a function that could fulfill my needs and wants of sending people back to guess the number again?




Aucun commentaire:

Enregistrer un commentaire