Learn Python EXCEPTION HANDLING in 5 minutes! π¦
# exception = An event that interrupts the flow of a program # (ZeroDivisionError, TypeError, ValueError) # 1.try, 2.except, 3.finall...

Bro Code
134.5K views β’ Jun 29, 2024

About this video
# exception = An event that interrupts the flow of a program
# (ZeroDivisionError, TypeError, ValueError)
# 1.try, 2.except, 3.finally
try:
number = int(input("Enter a number: "))
print(1 / number)
except ZeroDivisionError:
print("You can't divide by zero IDIOT!")
except ValueError:
print("Enter only numbers please!")
except Exception:
print("Something went wrong!")
finally:
print("Do some cleanup here")
# (ZeroDivisionError, TypeError, ValueError)
# 1.try, 2.except, 3.finally
try:
number = int(input("Enter a number: "))
print(1 / number)
except ZeroDivisionError:
print("You can't divide by zero IDIOT!")
except ValueError:
print("Enter only numbers please!")
except Exception:
print("Something went wrong!")
finally:
print("Do some cleanup here")
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
134.5K
Likes
4.0K
Duration
5:49
Published
Jun 29, 2024
User Reviews
4.7
(26) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
No specific trending topics match this video yet.
Explore All Trends