-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathcashier.py
40 lines (32 loc) · 1.09 KB
/
cashier.py
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
def get_invoice_items(items):
# Items is a dictionary with a quantity and price key, and a name key
# Return a list of all the invoice line items in the following format:
# quantity name subtotal currency
# For example, if we had the following:
# [
# {'name': 'Apple', 'quantity': 1, price: 0.2 },
# {'name': 'Orange', 'quantity': 4, price: 0.3 },
# ]
# We should return the following:
# ['1 Apple 0.200KD', '4 Orange 1.200KD']
# ---
# Write your code here
...
def get_total(items):
# Items is a dictionary with a quantity and price key
# Calculate the total of all items in the cart
# Write your code here
...
def print_receipt(invoice_items, total):
# invoice_items will be the list of formatted items received from
# `get_invoice_items`, and total will be a float. Print out a nice receipt
# displaying a title, all the invoice items on separate lines, and the
# total at the end.
# ---
# Write your code here
...
def main():
# Write your main logic here
...
if __name__ == "__main__":
main()