Question: Fix PYTHON code for GREEN CHECKSAssignment: A quite different way of using sentinels is to write guessing games. The sentinel becomes the value you need

Fix PYTHON code for GREEN CHECKSAssignment: A quite different way of using sentinels is to write guessing games. The sentinel becomes the value you need to guess. The game should keep going until the user guesses the right value.
player know if their guess is higher or lower than right_value. At the end, the program should display the number of guesses the player made.
Note: Take a look at the sample run. Make sure your program's prompts and messages are the same.
Sample Run (User input enclosed in >)
Enter\cdota\cdotguess: 1>
Your guess is too low.
Enter a guess: 50>
Your guess is too high.
Enter a guess: 22>
Your guess is too low
Enter a guess: 27>
Correct! It took you 4 guesses.right_value =27 # This could be set to random.randint(0,100) for variability
guess_count =0while True:
guess = int(input("Enter a guess: "))
guess_count +=1
if guess right_value:
print("Your guess is too low.")
elif guess > right_value:
print("Your guess is too high.")
else:
breakprint(f"Correct! It took you {guess_count} guesses.")
Fix PYTHON code for GREEN CHECKSAssignment: A

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 Programming Questions!