Jul-04-2022, 04:42 AM
(This post was last modified: Jul-04-2022, 04:42 AM by deanhystad.)
reverse reverses the list in place and returns None.
Read about reverse() here:
https://docs.python.org/3/tutorial/datas...e-on-lists
Or you might use the built-in slice() function.
Read about slice() here:
https://docs.python.org/3/library/functi...lice#slice
x = list(range(10)) print(x.reverse())
Output:None
To use reverse() to make a reversed copy you first need to make a copy of the list, then reverse the copy.Read about reverse() here:
https://docs.python.org/3/tutorial/datas...e-on-lists
Or you might use the built-in slice() function.
Read about slice() here:
https://docs.python.org/3/library/functi...lice#slice