Skip to content

Commit 7e56dea

Browse files
authored
added program of default arguments👩‍💻
1 parent ef1fef2 commit 7e56dea

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# Deualt arguments *args and *kwargs
3+
4+
5+
#def student(name = 'unknown name', age = 0): --1st
6+
7+
8+
def student(name, age, **marks): #*marks): # u can use double Asterix to declare key value pair # provide this type i.e. marks at the last so it can readable easily # USING METRIX IN FRONT OF ARGUMENTS IN PYHTON MEANS U CAN PROVIDE MULTIPLE ARGUMENTS
9+
10+
print("name : ", name)
11+
print('age : ', age )
12+
print('marks :', marks)
13+
14+
15+
16+
# u can use for loop with marks even
17+
18+
19+
20+
#student() # defuallt values when u don't provide values -- 1st
21+
22+
23+
student('rahul', 18,cs= 196, physics = 80, che = 74,maths = 67,english = 61, evs = 46) # whenever u use double asterix then it will print in the form of dictionary # IT WILL PRINT IN THE FORM OF TUPPLES

0 commit comments

Comments
 (0)