repl.it
@charles2588/

UnkownArguments

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#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))