The use of day-5while cycle

Introducing random module # # 
Import random
# call random integer random function module #
Secret the random.randint = (1,10)
# cutting line output VO + randomly generated number, to facilitate test (note str (secret) had to write not be added because the character and shaping need to be modified to unity string type) #
Print ( '------------------------------ ------------- '+ STR (Secret))
# define variables used in the while loop count defining the number of cycles #
count = 1
# start while loop defining the three cycles from the start of less than 1 4 A total of three numbers:, 2, 3 #
the while cOUNT <4:
# If you want to note here temp.isdigit (), you can not directly define temp = int (input (......) ),
# so first determine whether the user input, and then define a new variable equal to int (the TEMP)
the TEMP = the iNPUT ( "[Please guess my lucky number (only three chances Yo ~) is now the first" + str (count) + "times ]: ")
# restrict users to increase the number of decision-shaping digital input temp.isdigit () #
IF temp.isdigit ():
GUESS = int (the TEMP)
IF == Secret GUESS:
Print (" [hey I go, you must my stomach worms] ")
BREAK
the else:
IF GUESS> Secret:
Print ( "[Digital big, ha ha ~ ~]")
the else:
Print ( "[numeric, ha ha ~ ~]")
COUNT = COUNT + 1
the else:
Print ( "[please enter integer numbers 1-10] ")
IF COUNT == 4:
Print (" [good Bena, guessed right three times] ")!
Print (" [end of the game, welcome to the next play Meme da ~ ~ ~ ~] ")


Guess you like

Origin www.cnblogs.com/pythonzhao/p/11620992.html