Not working


#1

For the lesson, "10. It's Not All Animals and Fruits" no matter what I put it gives me "Traceback (most recent call last):
File "python", line 1, in
File "python", line 26, in ShoppingCart

File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init
File "python", line 7, in init

RuntimeError: maximum recursion depth exceeded while calling a Python object"


#2

For what it's worth this worked for me

class ShoppingCart(object):
"""Creates shopping cart objects
for users of our fine website."""

items_in_cart = {}
def __init__(self, customer_name):
    self.customer_name = customer_name

def add_item(self, product, price):
    """Add product to the cart."""
    if not product in self.items_in_cart:
        self.items_in_cart[product] = price
        print product + " added."
    else:
        print product + " is already in the cart."

def remove_item(self, product):
    """Remove product from the cart."""
    if product in self.items_in_cart:
        del self.items_in_cart[product]
        print product + " removed."
    else:
        print product + " is not in the cart."

my_cart = ShoppingCart("Eric")
my_cart.add_item("Ukelele", 10)


#3

Maybe you could possible post the code that was leading to the errors? Or part of it, because we're still making minor tweaks here.


#4

I figured it out but thanks


#5

Care to share what the actual issue was? That way you're helping out future visitors to these forums. :smile: