while loop follows these links from "b" until there is no next letter.
nxt = {"a": "c", "b": "a", "c": "d", "d": None}
node = "b"
path = []
while node:
path.append(node)
node = nxt[node]
print(path)
What does the program print?Log in to join the discussion.
Loading…