0
Why does >>>> print(listName.reverse()) not give any output ??
3 Antworten
+ 3
Hi Sandeep Singh,
You are not having an output because the list method 'reverse', reverses the list in place and
returns nothing. If you want to see the output do this:
# assuming letters is a list
letters.reverse()
print(letters)
0
here is an approach to get reversed list:
print(sorted(['z','y','x'], key=lambda i: i, reverse=False))
Sandeep Singh
- 1
It fails because there is nothing to print. If you put "" around letters, it should have an output