The Number Guessing Game

The specification: 

1) The computer chooses a number between 1 and whatever the player wants to use (1 to 100 for example) 

2) The player guesses a number 

3) If the guess is too high then the computer will say "you guessed too high" 

4) If the guess is too low then the computer will say "you guessed too low" 

5) The computer will keep asking for a guess until the user puts in the correct number

6) Count the number of guesses that the user has had

7) When the number is guessed output a message with the number of guesses. 

The are perhaps some more tasks you could add the the above such as getting the number range from the user. 

If you worked on the Animal Identifier you could use a user defined function like the one below 

To call this function we need to use code like this below.. 

The value returned from the function is placed into the chosenNumber variable by the assignment statement. 

You need to put at the top of your code 

import random

random.randint() is another way of getting a random number but as a definite integer. 

Some more tips if you need them....

Variables - you need a variable to hold the number of guesses and one to hold the computer chosen number. 

Output some instructions for the user

Decide if you are just making the game between 1 and 100 or if you are letting the user choose the upper limit. 

Don't forget that the variable you are entering needs to be a number (integer)