Posted by : ANIL KUMAR MULA Friday, 2 January 2015



#variable length arguments in function
def add(*x):
    sum1 = 0
    for i in x:
        sum1 += i
    return sum1

print(sum1)  #sum1 is out of its scope
print(add(2,3,4))
print(add(2,3,4,5,6,7))

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Anil Kumar Mula - Skyblue - Powered by Blogger - Designed by Johanes Djogan -