Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Writing to a JSON file
Summary
9. Exercise

Instruction

In memory, we have a list of to-do items saved in a variable named todos. They look like this:

{
  "userId": 10,
  "id": 200,
  "title": "buy castle",
  "completed": false
}

Let's find the unfinished task(s) in this list.

Exercise

From todos, choose those items that are unfinished. Save the result to a file named unfinished_todos.json.

Stuck? Here's a hint!

Loop over the todos list and append the ones that are not completed to a new list. You can use the following code snippet:

if not todo["completed"]: