Skip to content

Instantly share code, notes, and snippets.

@raeq
Created August 3, 2020 13:07
Show Gist options
  • Save raeq/bf1ce49bc7d59b850d7d8e1d20bca38e to your computer and use it in GitHub Desktop.
Save raeq/bf1ce49bc7d59b850d7d8e1d20bca38e to your computer and use it in GitHub Desktop.
Delete an item.
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