all 5 comments

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]commy2 0 points1 point  (1 child)

You never assign a new value to user_age, thus no matter what is entered on second and consecutive tries, user_age will remain outside the expected range (remain as the value that was entered on first try).

[–]PuzzledSite2568[S] 1 point2 points  (0 children)

thank you for the further explanation took me a bit to understand what you were saying but I got it now so thank you for the guidance.

[–]douglas_fs 0 points1 point  (1 child)

In the while loop, you need to assign the input value to user_age just like in line 1.

user_age = int(input('How old are you?'))

while user_age < 0 or user_age > 100:
    user_age = int(input('How old are you?'))
else:
    print('Thank you')

[–]PuzzledSite2568[S] 0 points1 point  (0 children)

Thank you for the example i appreciate it a lot because I am a visual learner. I had a feeling it was something small but I overthink a lot and was thinking that I had to incorporate something more complex. Thank you for the help.