Back to Lesson
Tuple Mutability Try-Catch
Attempt to modify an immutable sequence and catch the resulting error gracefully.
Instructions
- Given the tuple
config = ("dark_mode", "1080p") - In ablock, attempt to change the first element (
try) toconfig[0]"light_mode" - In theblock, print
except TypeError."Cannot modify tuple"
main.py
main.py
Ctrl + Enter