<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 2011/10/10 03:26 PM, Praveen Singh wrote:
    <blockquote
cite="mid:CAJcoizvqvGot=i_o6viURrWjH-FzAsxo456aURVS49sGmEBExw@mail.gmail.com"
      type="cite">This is my code-<br>
       def getNumbers(num):<br>
          myList=[]<br>
          for numbers in range(0,num,2):<br>
                print myList.append(numbers)<br>
                <br>
      <br>
      output-<br>
      &gt;&gt;&gt; getNumbers(10)<br>
      None<br>
      None<br>
      None<br>
      None<br>
      None<br clear="all">
      <br>
      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-<br>
      &gt;&gt;&gt; myList=[]<br>
      &gt;&gt;&gt; myList.append(8)<br>
      &gt;&gt;&gt; print myList<br>
      [8]<br>
      <br>
      Confused!!!<br>
      <br>
      <br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Tutor maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
To unsubscribe or change subscription options:
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a></pre>
    </blockquote>
    <br>
    If you seperate your print and the myList.append operation you will
    get what you want, which is why it works in IDLE.  Are you sure you
    don't want to rather build your list, and return it from your
    function and then when you call it you do `print getNumbers(10)` if
    you wish.<br>
    <br>
    <div class="moz-signature">-- <br>
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <title>Email Signature</title>
      <style type="text/css">
p { font-size:8.5pt; font-family: Arial, Helvetica, sans-serif; color: #000;}
.subscribe {font-weight:bold; font-style:italic;}
.compuscan {color: #c60c30; letter-spacing:2px; text-transform:uppercase; font-weight:bold}
.green {color:#093;}
</style>
      <p>Christian Witts<br>
        Python Developer<br>
        <br>
        <em class="green"></em></p>
    </div>
  </body>
</html>