Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Answer using python 3.6) Implement the GuessNumber game. In this game, the comp

ID: 3597836 • Letter: #

Question

(Answer using python 3.6)
Implement the GuessNumber game. In this game, the computer
• Think of a random number in the range 0-50. (Hint: use the random module.)
• Repeatedly prompt the user to guess the mystery number.
• If the guess is correct, congratulate the user for winning. If the guess is incorrect, let the user know if the guess is too high or too low.
• After 5 incorrect guesses, tell the user the right answer.
The following is an example of correct input and output.
I'm thinking of a number in the range 0-50. You have five tries to guess it.
Guess 1? 32
32 is too high
Guess 2? 18
18 is too low
Guess 3? 24
You are right! I was thinking of 24!

Explanation / Answer

import random randomNumber = random.randrange(0,100) print("Random number has been generated") guessed = False while guessed==False: userInput = int(input("Your guess pleas: ")) if userInput==randomNumber: guessed = True print("Well done!") elif userInput>100: print("Our guess range is between 0 and 100, please try a bit lower") elif userInputrandomNumber: print("Try one more time, a bit lower") elif userInput