blob: 57cff254c698bf56051e376927d0acd262eff4d7 (
plain)
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
|
total = int(input("how much does it cost: "))
totalPayed = int(input("how much did you get: "))
if totalPayed < total:
print(f"{totalPayed:.2f} is not enough to pay for {total:.2f}")
exit()
totalChange = totalPayed - total
changeToGive = []
while totalChange != 0:
if totalChange >= 10:
totalChange = totalChange - 10
changeToGive.append(10)
elif totalChange >= 5:
totalChange = totalChange - 5
changeToGive.append(5)
elif totalChange >= 2:
totalChange = totalChange - 2
changeToGive.append(2)
elif totalChange >= 1:
totalChange = totalChange - 1
changeToGive.append(1)
print(f"you need to give the customer : {changeToGive}")
|