For Example:
a = [1, 3, 5, 4, 2]
a = a.sort()
print(a)
Output:
None
a = [1, 3, 5, 4, 2]
a.sort()
print(a)
Output:
[1, 2, 3, 4, 5]
My question is why does a = a.sort()
reslt in None
rather than [1, 2, 3, 4, 5]
? But without a=
it gives me [1, 2, 3, 4, 5]
.
Thank you