Small game viewing
. 1 # Coding: UTF. 8- 2 Import random . 3 . 4 . 5 # using a random number to generate a random from 1 to 10 . 6 luckeyNum the random.randint = (1,10 ) . 7 . 8 # number defined guess . 9 limitCount. 3 = 10 . 11 the while limitCount > 0: 12 is # Get input 13 is yourNum = int (iNPUT ( " the enter your GUESS number (1-10): " )) 14 15 # decremented. 1 16 limitCount- =. 1 . 17 18 is # size-determination 19 IF yourNum> luckeyNum: 20 Print ( " Too Large! " ) 21 elif yourNum < luckeyNum: 22 Print ( " ! Too Small " ) 23 the else : 24- Print ( " ! Yes, you're right " ) 25 # BREAK is necessary 26 BREAK 27 the else : 28 # the while executing the normal code is the implementation of this paragraph, java does not have this feature, excellent! 29 Print ( " Sorry, Times Used up! ")