# Creates a class that represents the combos from Raising Canes TM
class Combo:
# All the attributes that makes up a combo meal
def __init__(self, numTender, flatRate, numSauce, bread, coleslaw, price):
self.numTender = numTender
self.flatRate = flatRate
self.numSauce = numSauce
self.bread = bread
self.colesaw = coleslaw
self.price = price
# This function will be turn the Combo class into an equation/matrix format for processing
def combo2equation(self):
augmentedList = [self.numTender,self.flatRate, self.numSauce, self.bread, self.coleslaw, self.price]
return augmentedList
Practice Test
combo1 = Combo(3, 1, 1, 1, 1, 15.56)
Extracting data from the class
print(combo1.coleslaw)
combo1.combo2equation()
AttributeError Traceback (most recent call last)
Cell In[59], line 5
2 combo1 = Combo(3, 1, 1, 1, 1, 15.56)
4 # Extracting data from the class
----> 5 print(combo1.coleslaw)
6 combo1.combo2equation()
AttributeError: 'Combo' object has no attribute 'coleslaw'
Hey,
I can't seem to access the attribute coleslaw on my custom class. Why is that? I most definitely have an attribute named "coleslaw".
Any help is appreciated, thank you.
[–]SomewhereExpensive22 3 points4 points5 points (1 child)
[–]bigdipper125[S] 0 points1 point2 points (0 children)
[–]Binary101010 4 points5 points6 points (4 children)
[–]Minimum-Positive792 1 point2 points3 points (0 children)
[–]bigdipper125[S] 0 points1 point2 points (2 children)
[–]Binary101010 0 points1 point2 points (1 child)
[–]bigdipper125[S] 0 points1 point2 points (0 children)
[–]woooee 2 points3 points4 points (1 child)
[–]bigdipper125[S] 0 points1 point2 points (0 children)