I have written this code for a class and the outcomes are correct, but I did not realize that I needed to incorporate a for-loop into the function. The exact words from the problem are "Hint, use a variable number of arguments (*values) and access them with a for loop." I don't really understand this and I think all I need to do is add a for loop somehow.
I haven't tried anything yet because i'm really bad with for-loops and don't want to mess up the code that I have. Anything helps. This is my code so far:
def values(num1 , num2 , num3):
sum = num1 + num2 + num 3
ave = sum / 3
x = max (num1 , num2 , num3)
y = min (num1 , num2 , num3)
product = num1 * num2 * num3
return sum , ave , x , y , product
sum , ave , x , y , product = values(2 , 2 , 2)
print(sum)
print(ave)
print(x)
print(y)
print(product)
6
2.0
2
2
8