im new to python and am struggling to understand why i keep getting "AttributeError: worker instance has no attribute 'workerNo'" when i call main().
beltLength = 5
class worker:
def __init__(self, wId):
workerNo = wId
def main():
production_Line = productionLine()
workers = []
for index in xrange(0, beltLength*2):
workers.append(worker(index))
print workers[index].workerNo
My thinking is that it should append 10 new worker instances with a workerNo attribute which is equal to index in a list. Thanks