diff --git a/employee-salary-calculation/shopping_cart_module.py b/employee-salary-calculation/shopping_cart_module.py index f165d80..9a8eea5 100644 --- a/employee-salary-calculation/shopping_cart_module.py +++ b/employee-salary-calculation/shopping_cart_module.py @@ -5,10 +5,10 @@ def __init__(self): def add_item(self,item): "Adding and updating the items into the cart" - if not self.shopping_cart.has_key(item.item_name): + if item.item_name not in self.shopping_cart.keys(): self.shopping_cart.update({item.item_name:item.item_quantity}) else: - for key,value in self.shopping_cart.iteritems(): + for key,value in self.shopping_cart.items(): if key == item.item_name and value == item.item_quantity: print ("The item and quantity you are trying to add are in the shopping cart already,no need to add it") @@ -22,7 +22,7 @@ def remove_item(self,item): "Removing an item from the list" if not self.shopping_cart: print("There is no shopping cart and you cant delete it") - for key,values in self.shopping_cart.iteritems(): + for key,values in self.shopping_cart.items(): if key ==item.item_name and values == item.item_quantity: item_to_remove = key self.shopping_cart.pop(item_to_remove)