Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- income = ['sdjhgs', [1, 2, 4, [(1, 2), 76, 'dsg', 13],[1]], 1, 2, (12)]
- outcome = ['sdjhgs', 1, 2, 4, 1, 2, 76, 'dsg', 13, 1, 1, 2, 12]
- def unpack(l):
- '''
- '''
- result = []
- for i in l:
- if hasattr(i, '__iter__'):
- r = unpack(i)
- result.extend(r)
- else:
- result.append(i)
- return result
- result = unpack(income)
- print 'income: {}'.format(income)
- print 'predicted outcome: {}'.format(outcome)
- print 'result: {}'.format(result)
- print 'predicted outcome == result? {}'.format(outcome == result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement