Python 3 sort() problem
fabien.maussion at gmail.com
Mon Aug 17 16:12:39 CEST 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...
More information about the Python-list