# first: works fine

x = [1, 2, 4, 2, 1, 3]
x = list(set(x))
x.sort()
print(x)  # output: 1, 2, 3, 4

# second: why x became None ??

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?



 

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to