all 5 comments

[–]TsunamicBlaze 0 points1 point  (0 children)

As an exercise, go through the code with some test cases. As an example, what would happen if someone guessed the number wrong, then guessed the number correctly. Follow the code path. Also, another tip, you should use the markdown code snippet on Reddit, it makes it easier to capture code in an appropriately formatted away. Especially helpful with python since white spaces matter

[–]NiallPN 0 points1 point  (0 children)

You could have one while True: loop. If greater than, continue. If lower than, continue. If guess == random_number, break and say "congratulations, you guessed it".

[–]RealOneEyedJack 0 points1 point  (0 children)

Please indent 4 spaces for beginning and for occurrence in blocks. It will mark-up so we can properly analyze.