FAQ
While trying to print a none empty list, I accidentaly put an "else"
statement with a "for" instead of "if". Here is what I had:

if ( len(mylist)> 0) :
for x,y in mylist:
print x,y
else:
print "Empty list"

which was supposed to be:

if ( len(mylist)> 0) :
for x,y in mylist:
print x,y
else:
print "Empty list"


Is this to be expected?
(python 2.2.2)

++++++++++++++++++++++++++++++=
for x in range(5):
... print x*x
... else:
... print "done"
...

1
4
9
16
done
++++++++++++++++++++++++++++++=

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 24 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedSep 25, '03 at 1:31p
activeOct 2, '03 at 1:59p
posts24
users13
websitepython.org

People

Translate

site design / logo © 2023 Grokbase