Skip to content

Instantly share code, notes, and snippets.

@agusrichard
Last active November 27, 2021 07:24
Show Gist options
  • Save agusrichard/5f6b1bd4b5632c180537333b027df755 to your computer and use it in GitHub Desktop.
Save agusrichard/5f6b1bd4b5632c180537333b027df755 to your computer and use it in GitHub Desktop.
product = {
'price': 2000, # remove this to run the exception handling
'name': 'Burger',
'description': 'The tastiest burger ever'
}
try:
print(f"{product['name']} costs {product['price']}")
except:
print('There is no product\'s name and price')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment