Python 3 sort() problem
Fabien
fabien.maussion at gmail.com
Mon Aug 17 10:12:39 EDT 2015
On 08/17/2015 01:42 PM, Владислав wrote:
> x = [1, 2, 4, 2, 1, 3]
> x = list(set(x)).sort()
> print(x) /# output: None/
>
> I know that sort() returns None, but I guess that it would be returned x
> that was sorted. Why so?
If sort() returns None, than the following:
x = list(set(x)).sort()
is equivalent to writing:
x = None
So I don't really understand your question, I'm sorry...
Cheers,
Fabien
More information about the Python-list
mailing list