+ 4
(Py) Is there a way to display the items in a linked lists in reverse order?
Please check my code, I tried to display the items in linked list in a reverse order, and got a warning "error: None-type objects are not iterable". https://code.sololearn.com/cjHDp10AJTH7/?ref=app
2 Antworten
+ 4
list.reverse() has no return, and it directly reverses the list, thus default return None.
You can change it to:
run_list.reverse()
for ii in run_list:
or
for ii in (run_list.reverse() or run_list):
+ 4
𝓕𝓛𝓨 It works! Thank you very much for helping me!