-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoftware_sales.py
More file actions
36 lines (32 loc) · 1.21 KB
/
software_sales.py
File metadata and controls
36 lines (32 loc) · 1.21 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
################################################################################
# Description: Calculate the discount from given quantity
################################################################################
quantity = float(input("Please input the number of packages to be purchased: "))
discount = int()
if quantity > 0:
# No discount applied less than 10
if quantity < 10:
print(" No discount applied.")
discount = 1.0
# Discount applied 10 - 19 quantity
elif quantity < 20:
print(" 10% discount applied.")
discount = 0.90
# Discount applied 20 - 49 quantity
elif quantity < 50:
print(" 25% discount applied.")
discount = 0.75
# Discount applied 50 - 99 quantity
elif quantity < 100:
print(" 35% discount applied.")
discount = 0.65
# Discount applied 100 or more
else:
print(" 45% discount applied.")
discount = 0.55
total_amount = quantity * discount * 99.0
print(f' The final price for purchasing {quantity:.0f} packages is ${total_amount:,.02f}.')
#print "The final price for purchasing", quantity, "packages is $", total_amount, "."
else:
# Other input 0 or less
print(" Invalid Input!")