Created
August 3, 2020 13:07
-
-
Save raeq/bf1ce49bc7d59b850d7d8e1d20bca38e to your computer and use it in GitHub Desktop.
Delete an item.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digits: dict = {i: chr(+i) for i in range(48, 58, 1)} | |
key = 50 | |
try: | |
val = digits.pop(key) | |
except KeyError: | |
print (f"The item with key {key} did not exist.") | |
else: | |
print(f"Deleted item with key {key} with value {val}.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment