-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccounting.py
85 lines (65 loc) · 2.51 KB
/
accounting.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
melon_cost = 1.00
def customer_order_cal():
the_file = open('customer-orders.txt')
for line in the_file:
line = line.rstrip()
words = line.split('|')
'''separates out each line of the txt doc file into list items'''
customer_name = words[1]
customer_melons = float(words[2])
customer_paid = float(words[3])
'''assigns variable names for each item of the list'''
customer_expected = (customer_melons) * melon_cost
if customer_expected != (customer_paid):
print(f"{customer_name} paid ${customer_paid:.2f},",f"expected ${customer_expected:.2f}")
'''displays desired string of each log'''
the_file.close()
'''closes out the current doc file'''
customer_order_cal()
# customer1_name = "Joe"
# customer1_melons = 5
# customer1_paid = 5.00
# customer2_name = "Frank"
# customer2_melons = 6
# customer2_paid = 6.00
# customer3_name = "Sally"
# customer3_melons = 3
# customer3_paid = 3.00
# customer4_name = "Sean"
# customer4_melons = 9
# customer4_paid = 9.50
# customer5_name = "David"
# customer5_melons = 4
# customer5_paid = 4.00
# customer6_name = "Ashley"
# customer6_melons = 3
# customer6_paid = 2.00
# customer1_expected = customer1_melons * melon_cost
# if customer1_expected != customer1_paid:
# print(f"{customer1_name} paid ${customer1_paid:.2f},",
# f"expected ${customer1_expected:.2f}"
# )
# customer2_expected = customer2_melons * melon_cost
# if customer2_expected != customer2_paid:
# print(f"{customer2_name} paid ${customer2_paid:.2f},",
# f"expected ${customer2_expected:.2f}"
# )
# customer3_expected = customer3_melons * melon_cost
# if customer3_expected != customer3_paid:
# print(f"{customer3_name} paid ${customer3_paid:.2f},",
# f"expected ${customer3_expected:.2f}"
# )
# customer4_expected = customer4_melons * melon_cost
# if customer4_expected != customer4_paid:
# print(f"{customer4_name} paid ${customer4_paid:.2f},",
# f"expected ${customer4_expected:.2f}"
# )
# customer5_expected = customer5_melons * melon_cost
# if customer5_expected != customer5_paid:
# print(f"{customer5_name} paid ${customer5_paid:.2f},",
# f"expected ${customer5_expected:.2f}"
# )
# customer6_expected = customer6_melons * melon_cost
# if customer6_expected != customer6_paid:
# print(f"{customer6_name} paid ${customer6_paid:.2f},",
# f"expected ${customer6_expected:.2f}")