how to convert linked list to list in python

Solutions on MaxInterview for how to convert linked list to list in python by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to convert linked list to list in python"
Liam
04 Sep 2017
1# credit to the Stack Overflow user in the source link
2
3linked_list = {'a':'b', 'b': 'c', 'c': 'd', 'd': None}
4def next_ll(state=['a']):
5  value = state[0]
6  if value is not None:
7    state[0] = linked_list[value]
8    return value
9
10[x for x in iter(next_ll, None)]
11>>> ['a', 'b', 'c', 'd']