Re: [Tutor] confusion with else command

2012-02-07 Thread Peter Otten
Debashish Saha wrote: > 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? The else suite is not invoked because that's the way

Re: [Tutor] confusion with else command

2012-02-07 Thread Dave Angel
On 02/07/2012 01:52 PM, Debashish Saha wrote: 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? It works fine. The else clause of a for loop exe

[Tutor] confusion with else command

2012-02-07 Thread Debashish Saha
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? ___ Tutor maillist - Tutor@python.org To unsubscribe or c