最后活跃于 1731350546

修订 6907862b45638751a4eea9d3a7809369fdd6b911

TastyHint1.md 原始文件

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 tasks.items():
  print("- ", task_name, status)