Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I just want to know how to approach functions like this with tuples. I have two other similar functions with tuples that I'm working on.

def sum(tup):
?
Posted
Comments
Suvendu Shekhar Giri 7-Nov-15 0:26am    
Anything you have tried so far?

Python
dT = 1, 2, 3, 4, 5

def sumTuple(disTuple):
    a =0
    for x in range(0, len(disTuple)):
       a= a + disTuple[x]
    print(a)
    return(a)

sumTuple(dt)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900