19th Nov 2018, 4:41 PM
Chhotu kumar
Chhotu kumar - avatar
4 Réponses
+ 5
You didn't put the operation results into a list. def to_power(num, *args): output = [] for i in args: output.append(i**num) return output num = 2 l =[2,3,4] print(to_power(num, *l))
19th Nov 2018, 4:51 PM
Ipang
+ 4
You're welcome bro : )
19th Nov 2018, 4:53 PM
Ipang
+ 3
It works if you change it like this: def to_power(num, *args): for i in args: output = i**num yield output # changed num = 2 l =[2,3,4] print(list(to_power(num, *l))) # changed
19th Nov 2018, 4:54 PM
Paul
Paul - avatar
+ 1
Thank you bro
19th Nov 2018, 4:53 PM
Chhotu kumar
Chhotu kumar - avatar