Python exception handling ⚠️
Ғылым және технология
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: bit.ly/2JnDfCE
Music promoted by Audio Library • Up In My Jam (All Of A...
------------------------------
Пікірлер: 151
# 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")
@arafatmohammadasifbamboowa2211
2 жыл бұрын
Can we use elif instead of except??
@macklykyn8967
2 жыл бұрын
@@arafatmohammadasifbamboowa2211 I don't think so, cause you can't print what kind of exception
@ghobashi2000
Жыл бұрын
man, it's strange to say that but at first: thank you so much, i like people like you who help us a lot for free and also with a very good content i want to ask you to read about islam if u r not a muslim and try to read quran and Allah, i won't ask for more, just try reading about these topic in the intention of knowing the truth and following it. i just asked for this because i want to say thank your in a very good way, and i hope you don't get it wrong. btw keep this brilliant content and videos and thx again. take care
Best video I've seen on exception handling. Simple, clear, and straightforward.
2:00 damn so when websites say something went wrong its just the developers being lazy lol
@damansomaiah6535
6 ай бұрын
Not really, it's practically impossible to cover every single possible error in a website, if you get the ones that are covered though it will specify
@2bfrank657
Ай бұрын
@@damansomaiah6535A clear reason to not simply except all exceptions is that you prevent the original exception message from being presented to the user. "Something went wrong" is less useful to the user than whatever error message the underlying code would have given.
@DanielHai-ow3km
22 күн бұрын
Or you are not supposed to know, that might be bad for their PR
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 ❤
Always great tutorials, never stop making excellent tutorials
this man in single handily gonna get me through my programming course
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
You are excellent exception in python programming ... You explain so perfectly...thank you😁
That is pretty easy to understand that I find my thoughts circling in the class. Thank you bro
Nice! Glad my professor showed me this channel :)
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!!!!
I just started to learn Python and i wanted to thank you for the good videos . Thanks !
Hell yeah!👍 You are the best teacher I've ever found
Pre-eminent tutorial !! Thank You
I must say that this was an EXCEPTIOANALLY great tutorial video..!
Thank you so much! This video helped to understand my homework!!
Very easy to understand ....thank you so much😊
Didn't know the term 'exception handling', but this video helped me tremendously after I typed in my problem. Thank you!
As usual, Bro nailed it 💪
your videos helped me alot, thanks man keep it up :)
this is the stuff I like on my KZread feed!! thanks Bro
Great way of explaination 😄
Nice explanation, thanks for the video
Nice work. Thanks!
You rock...Keep up good work
finally, a video that is easy to understand.
Great lecture 🤯
thank you bro i made the mistake of not putting the input thingys inside the try statements and now i fixed it
Bro makes learning coding easy!!!
Question from newbie: and how to do this on large file? i.e. do you create separate .py file to handle errors or we need to do it this way? Thank you in advance
love your vids
amazing !
Thank you bro,watching from republic of mindanao
ıdk what to comment but here is one to support you bc you support us big guy
amazing man this is what i was looking for.
You are grateful
tysm so helpful for a beginner
Absolutely great
May God bless you for this!
Dude YOU ARE THE BEST EVER!!!!
very nice class
amazing😍😍
Thx for teaching 🎉🎉🎉
Much appreciated
Thank you!!
thanks man you realy are hero for real
These videos just cannot be disliked ❤
Quality content bro
Thanks.... God bless you....
Thanks!!🌷🌷
i learned a lot, thanks
Explanations so good I fail NNN from coding euphoria
Duuuude this video was awesome 👌 👏 👍 😍
Thanks for the video bro
exceptional 😀
Thank you!
Good vid once again🙂
Thanks bro!
Nice
Is finally block is useful? We can also add a statement in last also
Nice Video!
Great!
niceeee😍
Thanks bro ❤️
great vid!
well explained
Thanks,bro
NICE!
guys Im currently following this playlist to learn python, Im just wondering if this is enough for me to start solving leetcode problems or I need to learn more method or syntaxes or something else?
Thank you Broseph Broestar
Bro you are awesome
Thanks
good
good tutor bro
U r legend!
Your youtube channel + Programming for Everybody (Getting Started with Python) on Coursera, the best way to learn Python !
@TheJossephc
10 ай бұрын
HOW LONG AGO DID YOU TAKE COURSERA'S COURSE?
Thanks dude
thank you
Thanks bro
How would I make it say that {whatever you typed in} is not a number
Yo bro cool vid
Thanks Bro
Do game developer always put their entire codes inside a try-except-finally block?
I FINALLY CATCH IT THANKKKKS ...
thanks
good teach🍕
Good job broo :)
love u bro
thanks !
tq
ty
thx bro
Wow!
thank you........
The best
2:55 the most Dwight Schrute thing I've ever heard 😂
@FaizanShaikh-dq1fs
2 жыл бұрын
😂😂😂I was going to comment the same, identity theft is not a joke!!!😂
@laurabassino6721
2 жыл бұрын
@@FaizanShaikh-dq1fs Beets, Bears, Battlestar Galactica
@FaizanShaikh-dq1fs
2 жыл бұрын
@@laurabassino6721 "Micheal Micheal " lol , btw did you complete all python course of bro code?
@laurabassino6721
2 жыл бұрын
@@FaizanShaikh-dq1fs not yet
@gurudathg1328
Жыл бұрын
@Laura Bassino 🤣🤣
bro is cooking man
I like the "You can't divide by zero! Idiot!" I had just finished typing "You fucked up hard" to print under 'except Exception:'
what is the point of having an "else" statement? because if an error occurred then nothing would be outputted anyways so whats the point
thanks for this video 58 more videos to go