0
Whats wrong with it
4 Respostas
+ 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))
+ 4
You're welcome bro : )
+ 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
+ 1
Thank you bro