Python exception handling ⚠️

Published: 21 December 2020
on channel: Bro Code
74,477
4.9k

Python exception handling tutorial example explained

#python #exception #exceptions

exception = events detected during execution that interrupt the flow of a program

try:
numerator = int(input("Enter a number to divide: "))
denominator = int(input("Enter a number to divide by: "))
result = numerator / denominator
except ZeroDivisionError as e:
print(e)
print("You can't divide by zero! idiot!")
except ValueError as e:
print(e)
print("Enter only numbers plz")
except Exception as e:
print(e)
print("something went wrong :(")
else:
print(result)
finally:
print("This will always execute")

––––––––––––––––––––––––––––––
Up In My Jam (All Of A Sudden) by - Kubbi   / kubbi  
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
Free Download / Stream: http://bit.ly/2JnDfCE
Music promoted by Audio Library    • Up In My Jam (All Of A Sudden) – Kubb...  
––––––––––––––––––––––––––––––


Watch video Python exception handling ⚠️ online without registration, duration hours minute second in high quality. This video was added by user Bro Code 21 December 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 74,477 once and liked it 4.9 thousand people.