[Tutor] I am trying to print list elements but i am getting 'none'
Praveen Singh
c2praveen30jun at gmail.com
Mon Oct 10 15:26:31 CEST 2011
This is my code-
def getNumbers(num):
myList=[]
for numbers in range(0,num,2):
print myList.append(numbers)
output-
>>> getNumbers(10)
None
None
None
None
None
Then i find out that list.append doesn't return anything.Then what should i
use for this kind of operation.but if i do something like this on idle's
interpreter it gives me answer-
>>> myList=[]
>>> myList.append(8)
>>> print myList
[8]
Confused!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111010/2b4c9180/attachment.html>
More information about the Tutor
mailing list