I would like to build a function that gives me two lists as an output:
def times_10(i):
out = i * 10
return out, i
outpt,inpt = [times_10(i) for i in range(1,8)] #doesn't work
I have one way of doing it, but I have a feeling there must be something simpler:
a = [times_10(i) for i in range(1,8)]
outpt,inpt = list(map(list, zip(*a))) # this works
Expected output:
>>> outpt
[10, 20, 30, 40, 50, 60, 70]
>>> inpt
[1, 2, 3, 4, 5, 6, 7]