[Tutor] Working with lists - why does my script not work?
Alan Gauld
alan.gauld at btinternet.com
Mon Jun 25 22:23:40 CEST 2012
On 25/06/12 14:39, Puneeth Chaganti wrote:
> `sorted`[0] returns a new list unlike `sort`[1], which sorts a list in-place.
>
> Something like this, would work:
>
> words = sorted(words)
> x_list = sorted(x_list)
or just
words.sort()
x_list.sort()
which will work in place as mentioned above.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list