-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloops_task.py
More file actions
55 lines (35 loc) · 987 Bytes
/
loops_task.py
File metadata and controls
55 lines (35 loc) · 987 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import time
import datetime
cashier_list = []
name =''
quantity = 0
price = 0.0
print("""
XYZ Point of Sales (POS)
DATE | TIME {}
by Abdullah Alhasan!
""".format(datetime.datetime.now()))
while True:
name= input("Type Item's Name or 'done' If You Finished..>")
if name == 'done':
break
price = input("Type in Item's Price..>")
quantity = input("Type Quantity..>")
cashier_list.append({'name': name,
'price': price,
'quantity': quantity})
print("""
=========================
........RECEIPT..........
=========================
""")
time.sleep(1)
total = 0
for item in cashier_list:
total_per_item = int(item['quantity']) * float(item['price'])
print("{} (Price per item: {}) - Quantity: ({}) - Total: {}KWD".format(item['name'].upper(),item['price'],item['quantity'],round(total_per_item,3)))
total += total_per_item
print("""
=========================
GRAND TOTAL: {} KWD
""".format(round(total,3)))