Hello,
how do i reverse a list ?
X = (IN[0]).reverse
OUT = X
i get no correct results
is it because of using sandbox?
KR
Andreas
Hello,
how do i reverse a list ?
X = (IN[0]).reverse
OUT = X
i get no correct results
is it because of using sandbox?
KR
Andreas
It’s because your list is in a list. You have a list of a single item (list). That single item reversed is still that single item. There’s no need for brackets in your codeblock.
The syntax for reversing a list in python is myList.reverse()
.
@L2 on the list reverse node, or remove the []
from your code block.
You’ve made a list of lists (the … already forms a list, the []
isn’t required unless you want make sublists or change the level) so the list.reverse node is reversing your list of 1 items at L3 instead of your list of 26 items at L2