MCPcopy Index your code
hub / github.com/geekcomputers/Python / GroceryList

Class GroceryList

Grocery calculator.py:12–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10# Object = GroceryList
11# Methods = addToList, Total, Subtotal, returnList
12class GroceryList(dict):
13 def __init__(self):
14 self = {}
15
16 def addToList(self, item, price):
17 self.update({item: price})
18
19 def Total(self):
20 total = 0
21 for items in self:
22 total += (self[items]) * 0.07 + (self[items])
23 return total
24
25 def Subtotal(self):
26 subtotal = 0
27 for items in self:
28 subtotal += self[items]
29 return subtotal
30
31 def returnList(self):
32 return self
33
34
35"""Test list should return:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected