Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #the next line of code declares a database called "tasks"
- tasks = {'1': {'complete': True, 'goodIdea': True, 'for2019': True}, '2': {'complete': False, 'goodIdea': True, 'for2019': True}, '3': {'complete': False, 'goodIdea': True, 'for2019': False}, '4': {'complete': False, 'goodIdea': False, 'for2019': False}, '5': {'complete': True, 'goodIdea': True, 'for2019': True}, '6': {'complete': False, 'goodIdea': False, 'for2019': False}, '7': {'complete': False, 'goodIdea': False, 'for2019': False}, '8': {'complete': True, 'goodIdea': True, 'for2019': True}, '9': {'complete': True, 'goodIdea': True, 'for2019': True}, '10': {'complete': False, 'goodIdea': True, 'for2019': True}, '11': {'complete': False, 'goodIdea': True, 'for2019': True}, '12': {'complete': False, 'goodIdea': True, 'for2019': True}, '13': {'complete': False, 'goodIdea': True, 'for2019': True}, '14': {'complete': False, 'goodIdea': False, 'for2019': False}, '15': {'complete': False, 'goodIdea': True, 'for2019': True}, '16': {'complete': False, 'goodIdea': True, 'for2019': False}, '17': {'complete': False, 'goodIdea': True, 'for2019': False}, '18': {'complete': False, 'goodIdea': True, 'for2019': False}}
- #I would not try and edit the line of code above in an editor
- #Instead edit it and read it through using commands
- #Some commands to use:
- #To change a specific value use:
- #tasks[<task number>][<field>] = <new value>
- #To find a all task numbers that meet a requirement you could
- #use an algorithm similar to the one below
- validTasks = []
- for taskNum in tasks:
- if tasks[taskNum]['complete'] == True:
- validTasks.append(taskNum)
- for validTask in validTasks:
- print(validTask)
- #to add a new task to the tasks database use:
- #new_entry['complete'] = <True/False>
- #new_entry['goodIdea'] = <True/False>
- #new_entry['for2019'] = <True/False>
- #tasks[<number of the task you are adding>] = new_entry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement