Skip to content

Commit f64ea44

Browse files
committed
Ap_Akarguments.py
1 parent b142f06 commit f64ea44

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Ap_Akarguments.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
def add(*numbers):#Arbitrary Positional Arguments
2+
c=0
3+
for i in numbers:
4+
c=c+i
5+
print(f"sum is {c}.")
6+
add(5,8)
7+
add(1,2,3,4,5)
8+
9+
def add(*numbers,name):
10+
print(numbers)
11+
print(name)
12+
add(1,2,name="Jenny")
13+
14+
def add(a,*numbers):
15+
print(numbers)#1 is assign to a
16+
add(1,2,3)
17+
18+
def info_person(**kwargs):#Arbitrary Keyword argument
19+
for key,value in kwargs.items():
20+
print(key,value)
21+
info_person(name="Ram",age=30,dept="CSE")
22+
info_person(name="Shyam",dept="CSE")
23+
24+
def info_person(*args,**kwargs):#Arbitrary Keyword argument
25+
for key,value in kwargs.items():
26+
print(key,value)
27+
print(args)
28+
info_person(1,2,name="Ram",age=30,dept="CSE")
29+
info_person(1,2,3,name="Shyam",dept="CSE")

0 commit comments

Comments
 (0)