-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession5(a).py
More file actions
43 lines (33 loc) · 1.13 KB
/
session5(a).py
File metadata and controls
43 lines (33 loc) · 1.13 KB
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
def applyPromoCode(code, amount):
if code == "FLAT50":
discount = amount*(50/100)
print("please pay:>>",amount - discount)
elif code == "FLAT30":
discount = amount*(30/100)
print("please pay:>>",amount-discount)
elif code == "FLAT10":
discount = amount * (10 / 100)
print("please pay:>>", amount - discount)
else:
print("no discounts")
def getDiscount(code, amount):
discount = 0.0
if code == "FLAT50":
discount = amount*(50/100)
#print("please pay:>>",amount - discount)
elif code == "FLAT30":
discount = amount*(30/100)
#print("please pay:>>",amount-discount)
elif code == "FLAT10":
discount = amount * (10 / 100)
#print("please pay:>>", amount - discount)
else:
discount = 0
return discount # return takes control from function to position where u have called the function
# anything return after return will not be executed
print("bye")
totalBill = 1000
#applyPromoCode("FLAT70",totalBill)
disc = getDiscount("FLAT50",1000)
print("discount is>>>",disc)
print("please pay>>",totalBill-disc)