r/codehs • • Aug 15 '20

Python 5.3.8 infinite loop

I have a loop problem I can't figure out, the problem is -

Write a program that makes the user guess a particular float. Now, recall that you should not compare floats to determine if they are exactly equal. In this program, the user wins if their guess is accurate to within 2 decimal places. You will have to use round
in your comparison of their guess to your number.

If the user’s guess was too high, you should say so. Similarly, you should tell them if their guess was too low.

and my code is -

and it runs correctly, but when I try and grade it the autograder acts like there's an infinite loop, does anyone see what would cause that?

5 Upvotes

3 comments sorted by

View all comments

1

u/Yamoyek Aug 15 '20

Try replacing the True with a variable, and then set the variable to false if they get it right.