On 10 October 2011 14:26, Praveen Singh <c2praveen30...@gmail.com> wrote:
> 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!!!
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>

Print your list after you have appended to it.

 def getNumbers(num):
    myList=[]
    for numbers in range(0,num,2):
          myList.append(numbers)

    for item in list:
        print item
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to