Why can't I reverse lists | Sololearn: Learn to code for FREE!


Why can't I reverse lists

Whenever I use the list.reverse() method on a list, my programs displays none whenever I try to print the reverse Anyone know why and how to correct this?

5/6/2021 4:35:53 PM


4 Answers

New Answer


List.reverse() won't display anything cause it updates the existing list. Try to print the list instead. letters = ['p', 'q', 'r', 's', 'p', 'u'] m=[1,2,3,4] print(letters.reverse(),m.reverse()) print(letters,m)


list.reverse() ,Reverses the elements of the list, in place. "in place" means the original list gets changed, rather than returning a new list, so the return you ask it to print is None.


sarada lakshmi your explanation taught me something I hadn't noticed since