Skip to content

Commit 5d90556

Browse files
authored
Update Grocery calculator.py
Fixed inconsistent use of tabs and spaces in indentation Updated print statements to match current syntax
1 parent f6bbb37 commit 5d90556

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Grocery calculator.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@
88

99
#Object = GroceryList
1010
#Methods = addToList, Total, Subtotal, returnList
11-
1211
class GroceryList(dict):
1312

14-
def __init__(self):
15-
self = {}
13+
def __init__(self):
14+
self = {}
1615

17-
def addToList(self, item, price):
18-
self.update({item:price})
16+
def addToList(self, item, price):
17+
18+
self.update({item:price})
1919

20-
def Total(self):
20+
def Total(self):
2121
total = 0
2222
for items in self:
2323
total += (self[items])*.07 + (self[items])
2424
return total
2525

26-
def Subtotal(self):
26+
def Subtotal(self):
2727
subtotal = 0
2828
for items in self:
2929
subtotal += self[items]
3030
return subtotal
3131

32-
def returnList(self):
32+
def returnList(self):
3333
return self
3434

3535
'''Test list should return:
@@ -44,12 +44,12 @@ def returnList(self):
4444
List1.addToList("kombucha", 3)
4545

4646

47-
print List1.Total()
48-
print List1.Subtotal()
49-
print List1.returnList()
47+
print(List1.Total())
48+
print(List1.Subtotal())
49+
print(List1.returnList())
5050

5151
#*****************************************************
52-
print
52+
print()
5353
#*****************************************************
5454

5555

@@ -59,6 +59,6 @@ def returnList(self):
5959
List2.addToList('wine', 25.36)
6060
List2.addToList('steak', 17.64)
6161

62-
print List2.Total()
63-
print List2.Subtotal()
64-
print List2.returnList()
62+
print(List2.Total())
63+
print(List2.Subtotal())
64+
print(List2.returnList())

0 commit comments

Comments
 (0)