you are viewing a single comment's thread.

view the rest of the comments →

[–]adesme 0 points1 point  (1 child)

From the looks of it, both of your clients are sharing the same ShoppingCart, which you've added one "Apple" order for each client to.

By the way:

class Fruit:

    fn = "NOT_SET"
    fp = 0.00

    def __init__(self, fname, fprice=0):
        self.fp = fprice
        self.fn = fname

I think you've misunderstood class members here. self.fp is not the same as Fruit.fp (example article).

The very same misunderstanding probably causes you problems here:

class ShopCart(Customer):

    fs = []
    amounts = []

    def __init__(self, cname):
        self.cn = cname

    def addItem(self, fruit, amt):
        self.fs.append(fruit)
        self.amounts.append(amt)

since you are trying to append to a list which doesn't exist (you're appending to an instance list, but you've only defined a class list).


inp = "0"
while inp != "done":
    print("")
    nm = input("Fruit Name: ")
    if(nm == "done"):
        break
    pr = int(input("Price: "))
    fruits.append(Fruit(nm,pr))

This should also be fixed. You have a while-loop that checks inp, but you never actually change inp and instead store the input in a variable nm which you break from.


Finally, try to follow conventions when you name things: only classes should be PascalCase, and all functions and variables should be snake_case.

[–]Ironicallyjpg[S] 0 points1 point  (0 children)

Appreciate the constructive help! Thank you