0

I was wondering if there were any legit usecases for writing an else statement after a while loop as they are valid in python?

eat = 0

while eat < 3:
    print(eat)
    eat += 1
else:
    print("done")

i cannot think of any usecases but my friend says there is one but doesnt know it

wjandrea
  • 28,235
  • 9
  • 60
  • 81

0 Answers0