From the course: Programming Foundations: Data Structures (2023)

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Challenge: Drop empty items

Challenge: Drop empty items

- [Instructor] Let's practice using dictionaries in Python. In this coding challenge, you'll create a function that takes in a dictionary and creates a new dictionary, removing the elements with empty values. It should not modify the original dictionary. For example, let's say I have a dictionary of user preferences. Here, the notification and theme keys are none. The new dictionary would only have the time zone, language and currency key value pairs. It's important to note that you might get an empty dictionary or a dictionary where there are no elements with the none value. There's also some starter code in GitHub Codespaces if you'd like to use that for your development. Good luck and happy coding.

Contents