Why does python use 'else' after for and while loops?

前端 未结 21 1873
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-21 06:57

I understand how this construct works:

for i in range(10):
    print(i)

    if i == 9:
        print(\"Too big - I\'m         


        
21条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-21 07:41

    I read it something like:

    If still on the conditions to run the loop, do stuff, else do something else.

提交回复
热议问题