-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecorators.py
More file actions
30 lines (22 loc) · 797 Bytes
/
decorators.py
File metadata and controls
30 lines (22 loc) · 797 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
from Decorators_support import *
print("Program to Impliment the Decorator Functions : \n")
#decorators are functions through which we can modify the functioning of another function
#when we don't have the control to change the function defination
#Decorator : -----------------------------------------------------------------------------
def smart_div(funct):
#the number of params of inner fun and funct must be same :
#inner_fun stores the modified function:
def inner_fun(m, n):
if(m < n):
m, n = n, m
return funct(m, n)
return inner_fun
a = int(input("Enter the value of a : "))
b = int(input("Enter the value of b : "))
c = div(a,b)
d = smart_div(div)
result = d(a,b)
print("a =", a)
print("b =", b)
print("c =", c)
print("d =", result)