why I can not acces to values of my tuple

Viewed 24

I would like to write a simple code, which asks users to enter numbers seperated by comma, and pass this values to a function and print sum of values. But I got stuck. My function receives my values as tuple, but in the tuple I can not access for my entered values. I have only access to all values in value [0] :( I can not itarete them one by one in for loop.

Here is my code:

def adding(*values):
    total =0
    for actual_value in values:
        total = total + int(actual_value)
    else:
        print ("Sum of entered values:",total)


enteredvalues = input("Enter numbers, seperated by comma:").split(",")
adding(enteredvalues)
0 Answers
Related