+ 2
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?
4 Respuestas
+ 5
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)
+ 4
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.
+ 3
sarada lakshmi your explanation taught me something I hadn't noticed since