Question: I need help writing python program to simulate a simple number guessing game. The program will begin with asking the user to guess a number

I need help writing python program to simulate a simple number guessing game. The program will begin with asking the user to guess a number between 1 and 100, after the guess the program will display one of the following statements:

You guessed too high, please guess lower.

You guessed too low, please guess higher.

You guessed the number 99 in only 99 tries.

You ran out of guesses, the number was 99

I would need to import random; you must place the import random at the top of your code

Num=random.randrange(start, end, step)

Num=random.randint(start,end)

Num=random.randion()

Num=random.uniform(start, end)

The player only gets 10 tiers to guess the number. You will need to keep track of the numbers of guess.

The players guess must be an integer. The players guess cannot be below 1 or above 100, if so the program needs to inform the player that the guess is out of range.

Example output:

Welcome to the number guessing game. You will have 10 tries to guess a secret number between 1 and 100.

Enter your guess 1 of 10: 22

You guess to low, please guess higher

Enter your guess 2 of 10: 50

You guess to high, please guess lower

Enter your guess 3 of 10: 16

You guess to low, please guess higher

Enter your guess 4 of 10: 35

You guess to high, please guess lower

Enter your guess 5 of 10: 33

You guess the number 33 in only 6 tries

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!