This only happens because the python interactive command-line (what you
get when you just type 'python' in a terminal window) prints return
values automatically for you.
If you were executing
f(4)
in a program/script, the return value would be lost.
Paul
Payal Rathod wrote:
> On Mon, Apr 17,
Lists are mutable, you are right.
But the code you gave does not change the list. It changes the variable
element which is separate from the list myList.
If you want to change the list try something like this:
mylist = [ 'One', ' two', ' three ' ]
print mylist
newlist = []
for elemen
Very true.
Paul
Kent Johnson wrote:
> Paul D. Eden wrote:
>
>>Lists are mutable, you are right.
>>
>>But the code you gave does not change the list. It changes the variable
>>element which is separate from the list myList.
>>
>>If you want
If you have some programming experience already in another language you
may want to try the examples in http://www.diveintopython.org/toc/index.html
Paul
Payal Rathod wrote:
> Hi,
> As I mentioned I have been reading Python a lot in last 2 months but
> lack of examples and coding is not gettin