Question: Hi! I am using Python 3 and need to get my output just like the expected output. The codes should contain if - 0 in
Hi! I am using Python 3 and need to get my output just like the expected output. The codes should contain if
- 0 in which case the program should print Goodbye and end.
=== Goodbye!
- Or be between 1 10000 (inclusive). If it is not, it should print the following message and re-prompt the user:
=== Your guess must be between 1 to 10000. Please enter your guess:
- If the user has entered a correct guess, your program should print the message:
where X is the number of tries the user took. Your program should then terminate.
=== That's correct! You win!
You guessed my number in X guesses.
- If the user's guess is low, your program should print the message:
=== Your guess is too low.
- If the user's guess is high, your program should print the message:
=== Your guess is too high.
- If the guess is too high or too low, it should then prompt the user to guess again:
=== Please enter your guess:
If the user's guess is high, your program should print the message: Your guess is too high. / If the guess is too high or too low, it should then prompt the user to guess again: Please enter your guess: Expected output: This is what your output might look like if the user guessed the number in four tries: I'm thinking of a number from 1 to 10000. Try to guess my number! (Enter 0 to stop playing.) Please enter your guess: 50 Your guess is too high. Please enter your guess: 1000 Your guess is too low. Please enter your guess: 12000 Your guess must be between 1 to 10000. Please enter your guess: 1458 That's correct! You win! You guessed my number in 4 guesses. This is what your output might look like if the user quit playing: I'm thinking of a number from 1 to 10000. Try to guess my number! (Enter 0 to stop playing.) Please enter your guess: 5000 Your guess is too high. paease enter your guess: 100 Your guess is too low. Please enter your guess: 0 Goodbye! 729 16
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
