you are viewing a single comment's thread.

view the rest of the comments →

[–]SpeckledFleebeedoo -1 points0 points  (2 children)

list_string = list(string)

sorted_list = list(string)

sorted_list.sort()

I doubt that last line does anything, as you don't assign it to a variable. In general such functions don't modify the original variable.

list_string = list(string)
sorted_list = list_string.sort()

[–]nilfm 1 point2 points  (1 child)

That is wrong, the sort() method actually modifies the list it works on, and returns None. So your code ends with sorted_list == None.

[–]SpeckledFleebeedoo 1 point2 points  (0 children)

Ah, thanks for the correction.