[Tutor] confusion with else command

Debashish Saha silideba at gmail.com
Tue Feb 7 19:52:32 CET 2012


for i in range(1, 8):
    print(i)
    if i==3:
        break
else:
    print('The for loop is over')


Output:
1
2
3

Question:

but after breaking the for loop why the else loop could not work?


More information about the Tutor mailing list