-
Notifications
You must be signed in to change notification settings - Fork 1
/
16.5_function.py
55 lines (40 loc) · 1.61 KB
/
16.5_function.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Normal function with arguments
# studenntAttendence() yaha par 1 arguemtn pass kiya gaya hai jo ki stu roll number hai
def studenntAttendence(*stuRollNo):
# single student ka rollnumber print karne ke liye
# print('\n Roll No.', stuRollNo, 'is present.')
# multipal sutdnets ka rollnumeb print karne ke liye for loop ka use karenge.
for roll in stuRollNo:
print('\n Roll No.', roll, 'is present. Type: ',type(stuRollNo))
# studnets valriable me humne list type value pass kiya because hame multipal numebrs cahiye the.
# students = [1,2,3,4,5,6]
studenntAttendence(1,2,3,4,5,6)
# Example of function with arguemtns and retun value
# Jio ka sime: aru ho sakta hai | return value
# jio ki compnay jiska sim hai: variable jo bhar se aa raha hai | function define
# jio ka reprensetative jo sime dega: call karenge | retrun
# dakhs jisko sim cahiye hai: function ho sakta hai | value
# function hota kya kya hai:
# define kiye: logic in side
# arugemtns pass kiya
# call kiya
# Arbitrary Arguments, *args
def studenntAttendence(*stuRollNo):
# multipal sutdnets ka rollnumeb print karne ke liye for loop ka use karenge.
for roll in stuRollNo:
print('\n Roll No.', roll, 'is present. Type: ',type(stuRollNo))
studenntAttendence(1,2,3,4,5,6)
# Arbitrary Keyword Arguments, **kwargs
def studentBioData(**name):
print('\n', type(name) ,' is present.')
studentBioData(name='Daksh',Class='12')
# bioData = {
# 'name':'Dakhs',
# 'class':12,
# 'age':20
# }
# studentBioData(bioData)
# Default Parameter Value
def meriMarji(name='', age='', myclass=''):
print('\nHello,',name)
meriMarji()