Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """Please write recursive function, that take nested list and return flat list."""
- def make_flat(l):
- if len(l) == 0:
- return []
- head,tail=l[0],l[1:]
- if isinstance(head, list):
- return make_flat(head) + make_flat(tail)
- else:
- return [head]+make_flat(tail)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement