Back to Lesson
Filtering by Iteration
Cleanse a dictionary of inactive objects.
Instructions
- Given.
users = {"Alice": False, "Bob": True, "Carol": False, "Dave": True} - Create a new dictionary.
active_users = {} - Iterate over the original dictionary. If the value evaluates to, add that pair to
True.active_users - Print.
active_users
main.py
main.py
Ctrl + Enter