Zuletzt aktiv 1731350546

Änderung 923c2fc6843766ef0a725192654c59db854b7d11

TastyHint1.md Orginalformat

Remember start very small and build outward.

Hint 1

If you haven't already decided how to start...

This is the tasks variable.

    Tasty class.
    :param tasks: the user tasks

The most important thing is the tasks you're tracking. It tracks all the tasks, things that get added and removed.

What are the two things you want to track?

  • the name/title of the Task Buy Milk
  • status of Task complete or not yet

so in Python, if you have a pair things that need to be tracked together, a good possibility is a Dictionary.

Imagine a dict like this one:


tasks = {}   # creates an empty dictionary

tasks['Buy Milk'] = 'not yet'
tasks['Start Lab'] = 'completed'

tasks['Finish Lab'] = 'not yet'

# to test if something is done?

task_name = 'Buy Milk'

if tasks[task_name] == 'not yet':
  # task is unfinished
  pass
else:
  # task is 'complete'
  pass


# to list all the tasks

for task_name, status in enumerate(tasks.items()):
  print("- ", task_name, status)