Problem: I need to figure out how to pass a Fruit object to addFruit(fruit object) in FruitBasket. Would I pass something like fruit.Fruit? or fruit = Fruit()?
class Fruit(object):
def __init__(self, typeOfFruit, number, color):
self.theType = typeOfFruit
self.theNumber = number
self.theColor = color
class FruitBasket(object):
def __init__(self):
#the basket is empty upon initialization
self.theBasket = []
def addFruit(self, FRUIT OBJECT GOES HERE):
#SET THE FRUIT OBJECT EQUAL TO SOMETHING?
self.theBasket.append(FRUIT OBJECT GOES HERE)

New Topic/Question
Reply




MultiQuote





|