Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
https://repl.it/C7lO/1 created by charles2588
#when you are not aware about number of arguments to a function
#args are passed in list
def multiplynumbers(*args):
count=1
for i in args:count*=i
return count
print(multiplynumbers(1,2,3,4,5))
#keyword arguments are passed as dict()
def addnumbers(**kwargs):
count=0
for v in kwargs.values():
count+=v
return count
print(addnumbers(a=1,c=2,b=3,e=4,d=5))
Python 3.5.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
120
15
=> None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.