ImportRandomnum= Random.randint (0,100)PrintNumtimes=0Print "number[0,100] Guess game"Print "You'll have ten times to guess"Print "Guess out of range would game over immediately!"Guess= Int (Raw_input ("guess a number:") Times= times + 1 whileTimes < 10: ifGuess<0orguess>100: Print "Your guess is out of range! Game over!" BreakElse: ifGuess >Num:Print "Too high,guess again!" elifGuess <Num:Print "Too low,guess again!" Else: Print "You guess it. the number is:", num score= 10* (11-Times )Print "Times is :", timesPrint "Your score is", score BreakGuess= Int (Raw_input ("guess a number:") Times= times + 1Else: ifGuess >Num:Print "Too high,the number is:!", NumPrint "Guess times Over,game over!" elifGuess <Num:Print "Too low,the number is:!", NumPrint "Guess times Over,game over!" Else: Print "You guess it. the number is:", num score= 10* (11-Times )Print "Times is :", timesPrint "Your score is", score
Python Beginner--the first to guess the number of small games