Skip to content
CodeItRaw
Code Reading
/
Reverse the List
Path
Play
Daily
Leaderboard
tr
Bug Hunt
Reverse the List
The links are flipped correctly, but the function always returns None. Find the line and the kind of bug.
Click the line you think is wrong.
1
def
reverse
(head):
2
prev =
None
3
node = head
4
while
node:
5
nxt = node.next
6
node.next = prev
7
prev = node
8
node = nxt
9
return
node