What number am I thinking of?
A simple guessing game for young children asks the child to guess the number the computer has chosen at random. The child keeps guessing until they guess correctly.
⭐⭐⭐
Write a program that generate a random number and asks the user to guess the number, outputting whether the guess is correct, too high or too low. The program should also output the number of guesses taken once the number has been guessed correctly.
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
play_guess_the_number that:main program so that:What is the lowest number I can choose? :1
What is the highest number I can choose? :10
OK, let's play. How many guesses will you take?
Enter the number I'm thinking of: 5
Your guess is too low.
Enter the number I'm thinking of: 7
You've got it, I chose 7. It took you 2 guesses.