You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reverse() reverses a list in place, and deliberately does not return anything, to remind you it's not a function, but something with a side-effect.
>>> l = [1,2,3]
>>> l.reverse()
>>> l
[3, 2, 1]
If you want a functional operation, use list.reversed(). Scott recently took a pull request from me that turned that on in CircuitPython, as well as some other things: #138.
I prefer reverse() for readability, but for now am using [::-1]
The text was updated successfully, but these errors were encountered: