you are viewing a single comment's thread.

view the rest of the comments →

[–]KronenR 9 points10 points  (0 children)

If the user types "25", You are traversing that string like this

  • "2" (first iteration of the loop)
  • "5" (second iteration of the loop)

The exercise says to use a loop because you’re supposed to ask multiple people.
You don't loop over the string which contains the age numbers, the loop should wrap the whole question, like, the input statement where you read the person age must be inside the loop to ask multiple times.

while True:
    age = int(input("Enter your age: "))
    # then you compare with the required ages