im looking for a oneliner (if possible) to return three values of a function and append them to three different lists directly after (here a, b, c).
My printout is "1 3 9" right now as my variables get repurposed in the loop. Im looking for following printout: [1, 1, 1] [3, 3, 3] [9, 9, 9]
Do you have an idea? Otherwise im going for a three- or four-liner. Id like to challenge pythons semantic though. ;)
def return_values_list():
"""Simple function to test how returns work."""
return [1, 3, 9]
a, b, c = [], [], []
for n in range(3):
a, b, c = return_values_list()
print (a, b, c)