[Tutor] Puzzled by print lst.sort()
Dick Moores
rdm at rcblue.com
Sun Oct 1 15:03:00 CEST 2006
At 01:37 PM 9/30/2006, Shantanoo Mahajan wrote:
>Maybe following is helpful:
>
> >>> a=[3,2,1]
> >>> b=a[:]
> >>> b.sort()
> >>> c=sorted(a)
> >>> print a,b,c
> >>> [3, 2, 1] [1, 2, 3] [1, 2, 3]
> >>>
>
>Shantanoo
Sorry to be dense, but I don't see what showing what happens to a
copy of list a adds to the explanation:
>>> a = [3,2,1]
>>> b = a[:]
>>> b.sort()
>>> b
[1, 2, 3]
>>>
given that:
>>> a = [3,2,1]
>>> a.sort()
>>> a
[1, 2, 3]
>>>
I suppose I've misunderstood how you were trying to assist me.
Thanks,
Dick
More information about the Tutor
mailing list