Back to Lesson
Configuration Fallback
Use the safe lookup features in dictionaries.
Instructions
- Given.
user_config = {"theme": "light"} - Print the user'susing
"timezone"with a fallback of.get()."UTC" - Then useto set the
.setdefault()to"theme"(which handles exiting keys) and"dark"to"language"."en" - Print the resultingdictionary.
user_config
main.py
main.py
Ctrl + Enter