Game rules:
Guess a random number, if you guessed the right to give the corresponding guessing success prompt (custom text), if the guess big or guess small, give the corresponding hint, but the total number of guesses is three times, each guess the wrong time to re-guess, to the user hint the remaining guess number
The implementation is as follows:
Import Random
guess = Int (raw_input ("Please enter the number you guessed:"))
Random_num = Random.randint (1,8)
Print Random_num
While guess! = random_num:
Print "You guessed wrong Oh!" "
For I in range (3):
guess = Int (raw_input ("I'll give you the%s chance next time, please continue to guess:"% (3-i)))
If guess > Random_num:
Print "You guessed too much."
Elif Guess < random_num:
Print "You guessed too little."
Else
Break
Else
Print "opportunity to use, not to play with you"
Break
Else
Print "You are too powerful, this can be guessed, but guess right is not rewarded!" \ n "\
"Don't guess, it's too hard to guess."
"Python27" guessing random number of small games