Beginner so please bear with me. I am trying to call an object from one class into the method of another. But I get a 'missing 1 required positional argument:' error. And when I play with the code I do not get any closer to a solution.
I removed "self" from the method to align the chore but then self.workload is not defined. I then added the object in twice (ch1,ch1) and got an error the error Chore' object has no attribute 'workload'. I played with (w1,ch1) and got the error that Workload has no attribute workload.
class Chore:
def __init__ (self, ch_name, value=1, completion=True):
self.ch_name = ch_name
self.value = value
self.completion = completion
class Workload:
def __init__ ():
self.workload = []
self.totalchores = 0
def add_chore (self,chore):
self.workload.append(chore)
self.totalchores+=1
ch1=Chore('pick up')
w1=Workload
w1.add_chore(ch1)
I expect to have c1 appended to a empty list.
TypeError: add_chore() missing 1 required positional argument: 'chore'