File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change 88
99#Object = GroceryList
1010#Methods = addToList, Total, Subtotal, returnList
11-
1211class 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):
4444List1 .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):
5959List2 .addToList ('wine' , 25.36 )
6060List2 .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 () )
You can’t perform that action at this time.
0 commit comments