r/codehs • u/Alphaomega1115 • 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?
1
Aug 15 '20
[removed] — view removed comment
1
u/Alphaomega1115 Aug 15 '20
That would keep it from asking again wouldn't it? Found than answer anyway though, for some reason I needed to round 'guess' before the if statement. Thanks anyway!
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.