Kposedaddy's Posts
Nairaland Forum › Kposedaddy's Profile › Kposedaddy's Posts
1 (of 1 pages)
please i am really stuck and frustrated.....and tomorrow is the deadline...can someone please help me look at this code and tell me what is wrong................this is message it gives me THERE IS AN ERROR/BUG IN YOUR CODE Results: Please re-read the instructions and check your code for non-implemented features. Make sure to complete all of them before submitting. Here is the relevant part of the stack trace: KeyError('Mango',), This is my code here........ class ShoppingCart(object): def __init__(self): self.total = 0 self.items = {} def add_item(self, item_name, quantity, price): self.products = self.items[item_name] = quantity self.cost = quantity * price self.total = (self.total + self.cost) def remove_item(self, item_name, quantity, price): if quantity > self.items[item_name]: self.total -= (self.items[item_name] * price) if item_name in self.items: del self.items[item_name] else: self.total -= (quantity * price) if item_name in self.items: del self.items[item_name] def checkout(self, cash_paid): if cash_paid < self.total: return "Cash paid not enough" else: self.balance = cash_paid - self.total self.total = 0 self.items = {} return self.total class Shop(ShoppingCart): def __init__(self, quantity=100): super(Shop, self).__init__() self.quantity = quantity def remove_item(self): self.quantity -= 1 return self.quantity PLEASE ASSIST...... |
gudchyld:bro please I need help with the oop test. someone should help pls I am running mad...@gudchyld and others that have completed |
Babadee30:i am getting the solutions wrong, they dont pass any of the tests |
please has anybody done his data structures and recursive labs? i am stuck and i need understanding of it please help |
please has anyone received invitation for the interview? cycle xix precisely please has anyone received invitation for the interview? cycle xix precisely please has anyone received invitation for the interview? cycle xix precisely |
1 (of 1 pages)