Question DSA-LL-0032
EasyWhat is the output of this code?
class Node:
def __init__(self, v, nxt=None):
self.v, self.nxt = v, nxt
h = Node(1, Node(2, Node(3)))
s = 0
while h:
s += h.v
h = h.nxt
print(s)
- A.
1
- B.
Error
- C.
Sign up free to see the answer and a step-by-step explanation.