Python exception handling ⚠️

preview_player
Показать описание
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")

––––––––––––––––––––––––––––––
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
––––––––––––––––––––––––––––––
Рекомендации по теме
Комментарии
Автор

# 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")

BroCodez
Автор

this man in single handily gonna get me through my programming course

TheWeirdTeenager
Автор

Best video I've seen on exception handling. Simple, clear, and straightforward.

KarinFields
Автор

So.... you know when people say i wish i could like this video 100 times, well i liked it twice, once on my phone and once on my laptop where i was taking notes from. Bro? How you make that so easy when 50 minutes ago i was sweating this topic? Now i can move on with confidence because im a bro learner 😂 Thanks Bro ❤

passportbro
Автор

Always great tutorials, never stop making excellent tutorials

elliotradley
Автор

You are excellent exception in python programming ... You explain so perfectly...thank you😁

shriniketkulkarni
Автор

2:00 damn so when websites say something went wrong its just the developers being lazy lol

Engmelli
Автор

Best code teacher I've ever seen!!! I know it's prolly easy for you, but I learned more from 3 of your videos than I learned from a week of Chat GPT. Thanks my dude!!! Will like and sub!!!!

BeanieK
Автор

Watched some other tutorials which just weren't clear to me at all, but your tutorial made me fully understand it. Thank you!

samirsardar
Автор

Didn't know the term 'exception handling', but this video helped me tremendously after I typed in my problem. Thank you!

AD-ccbj
Автор

That is pretty easy to understand that I find my thoughts circling in the class. Thank you bro

htetmyetthar
Автор

Right now i'm at my first semester in college and learning python became confusing since my teacher isn't helping much... Thanks to your videos, now I finally understand a lot of stuff. I'm currently studying for my text tomorrow and your videos are helping me a lot!! Thanks for taking your time to explain everything to us, and keep being the goat you are :]

PeriMochi
Автор

I just started to learn Python and i wanted to thank you for the good videos . Thanks !

ТодорПарушев-ич
Автор

Thank you bro...because of you i have come this far .
Very soon I will cover this playlist.
Never stop making videos.
I will always be grateful to you

Amit-mh
Автор

The best video i have watched so far that explains exception handling in very easy to understand way. Thanks Bro, for the video

joelngige
Автор

Nice! Glad my professor showed me this channel :)

GabeSkorski
Автор

The official docs make a lot of sense now after this video. Thnx!

SernaLovesYoongi
Автор

I must say that this was an EXCEPTIOANALLY great tutorial video..!

swetankraut
Автор

Hell yeah!👍 You are the best teacher I've ever found

Greenbay-bnyk
Автор

great video, i finally got to understand what exception handling is

luanolveira