Write a program that plays a guessing game with the user. The program should gen
ID: 3621546 • Letter: W
Question
Write a program that plays a guessing game with the user. The program should generate a random number between 1 and 100, and then prompt the user repeatedly to guess the number. When the user guesses incorrectly, the game should give the user a hint about the number of digits of the player’s guess matches the correct number. Once the user guesses correctly, the program should print a message showing the number of guesses that the user has made.
Sample log of the program execution may be as follows:
Try to guess my two-digit number, and I’ll tell you how many digits from your guess appear in my number.
Your guess? 13
Incorrect (hint: 0 digits match)
Your guess? 26
Incorrect (hint: 0 digits match)
Your guess? 78 Incorrect
(hint: 1 digits match)
Your guess? 70
Incorrect (hint: 2 digits match)
Your guess? 7
You got it right in 5 tries.