Search results
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.
Saved searches Use saved searches to filter your results more quickly
Now you need to compare the user input to the magic number and inform the user if the guess was too high, too low, or correct: if user_guess == magic_number: print "Correct!" break elif user_guess < magic_number: print "Too low, try again."
Python. Got: my_float = round (3.3312, 2) while True: guess = float (input ("Guess my number: ")) if guess > round (my_float, 2): print ("Too high!") elif guess < round (my_float, 2): print ("Too low!") elif round (guess,2) == round (my_float, 2): print ("Correct!") break. print ("Great job guessing my number!")
Test Cases ... Run
Exercise: Higher/Lower
If not, you can start with the original Higher/Lower code form the previous exercise. this one just requires you to get a float from the user instead of an int, and use rounding to 2 decimal places. to round, the code looks like this: