For example if I were using a list i would say
for i in taskList:
Print('item')
I was wondering how to do this with a dict also this dict is in another class. I have a class set up for the user to input tasks which adds it to a dict (this works) however now I want another class that pulls from the dict in the first class. is this possible? Here is a short example of what I've tried
class TaskList():
itemsToDoDic = {'Cleaning' : 0, 'Cook' :0}
classItems = TaskList()
class Importance():
classItems.itemsToDoDic
def levelOfImportance(self):
for i in self.ClassItems.itemsToDoDic:
importanceValue = int(input('Enter a
number 1 - 5')
I got the following errors:
- Instance of 'Importance' has no 'ClassItems' member
- Unused variable 'i'
- Unused variable 'importanceValue'