Guys, I am trying to sort a list. But Python does not let me set my new sorted list into a variable. here:
list1 = ['a', 'z', 'b', 'y']
sorted_list = list1.sort()
return sorted_list
When I run this on my interpreter, instead of printing my string sorted, it prints "None"
Why does it do that?
But when I go:
list1 = ['a', 'z', 'b', 'y']
list1.sort()
print list1
it returns my string sorted. But why does it return "None" when I assign it to a variable?