-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12_functions.py
More file actions
41 lines (33 loc) · 837 Bytes
/
Copy path12_functions.py
File metadata and controls
41 lines (33 loc) · 837 Bytes
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
'''
function-- block of code, run when its is called
#syntax
def function nam():}-- function defination
function body
function.name}--function call
'''
#syntax
def func():#function call
print("this is function call") #function body
func() #function call
#arbatiry Arguments # by using ["*"] we can use one argummnets with multiple function call
def func(*a):#function call
print("this is function call",a) #function body
func(1,2,3) #function call
#key word arguments
def func(**a):
print("this is function",a)
func(a=1,b=2)
#nested function -- function with in a function
def outer ():
print("outer function")
def inner ():
print("inner function")
inner()
outer()
# example
def add(a,b):
print(a+b)
def sub(a,b):
print(a-b)
add(3,3)
sub(6,3)