We all know that the sum() function in python only takes two arguements, so i created a function in python that will take any number of arguements and add them together, just like the sigma letter in greek.
Awaiting your replies on this one.
Function that adds all values inputed
#---------------------------------------------------#
"""-----------------ADEGOKE OBASA-----------------"""
"""------------adegokeobasa@yahoo.com-------------"""
"""--This functions adds all the values inputed---"""
def sumall(*args):
"""This function takes max arguements
and sums all the arguements"""
leng=len(args)
n=1
temp=args[n-1]
while n!=leng:
temp+=args[n]
n+=1
return temp
#example
#print(sumall(10,10,1,10,10,10,10,10))
#>>>
#71
e-papa
13
Posting Pro in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
e-papa
13
Posting Pro in Training
snippsat
661
Master Poster
e-papa
13
Posting Pro in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
e-papa
13
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.