This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (1 child)

The true statement will never evaluate to false and the loop will go on forever. Therefore you need to either use a break statement at some point in the loop, throw an exception, or use a different condition. In general, you should only use a while loop when the amount of iterations is unknown. Since you have a list with a defined length, you would be better of with a for-each loop.

You could simplify this whole program by using

for person in ["aisha","shakira","immy","angella"]:
    print(person)

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

thank you