Python exception handling ⚠️

  Рет қаралды 71,729

Bro Code

Bro Code

Күн бұрын

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...
------------------------------

Пікірлер: 184
@BroCodez
@BroCodez 4 жыл бұрын
# 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")
@ArafatMohammedAsif
@ArafatMohammedAsif 2 жыл бұрын
Can we use elif instead of except??
@macklykyn8967
@macklykyn8967 2 жыл бұрын
@@ArafatMohammedAsif I don't think so, cause you can't print what kind of exception
@ghobashi2000
@ghobashi2000 2 жыл бұрын
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
@TheWeirdTeenager2010
@TheWeirdTeenager2010 11 ай бұрын
this man in single handily gonna get me through my programming course
@KarinFields
@KarinFields Жыл бұрын
Best video I've seen on exception handling. Simple, clear, and straightforward.
@passportbro904
@passportbro904 Жыл бұрын
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 ❤
@elliotradley4370
@elliotradley4370 2 жыл бұрын
Always great tutorials, never stop making excellent tutorials
@SonyuCD
@SonyuCD 2 ай бұрын
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 :]
@shriniketkulkarni8169
@shriniketkulkarni8169 Жыл бұрын
You are excellent exception in python programming ... You explain so perfectly...thank you😁
@samirsardar7817
@samirsardar7817 4 ай бұрын
Watched some other tutorials which just weren't clear to me at all, but your tutorial made me fully understand it. Thank you!
@BeanieK1
@BeanieK1 10 ай бұрын
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!!!!
@Amit-m1h
@Amit-m1h Жыл бұрын
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
@ТодорПарушев-и8ч
@ТодорПарушев-и8ч 9 ай бұрын
I just started to learn Python and i wanted to thank you for the good videos . Thanks !
@htetmyetthar5650
@htetmyetthar5650 8 ай бұрын
That is pretty easy to understand that I find my thoughts circling in the class. Thank you bro
@Engmelli
@Engmelli 2 жыл бұрын
2:00 damn so when websites say something went wrong its just the developers being lazy lol
@damansomaiah6535
@damansomaiah6535 Жыл бұрын
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
@2bfrank657 8 ай бұрын
​@@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
@DanielHai-ow3km 7 ай бұрын
Or you are not supposed to know, that might be bad for their PR
@AD-cc7bj
@AD-cc7bj 11 ай бұрын
Didn't know the term 'exception handling', but this video helped me tremendously after I typed in my problem. Thank you!
@joelngige5776
@joelngige5776 4 ай бұрын
The best video i have watched so far that explains exception handling in very easy to understand way. Thanks Bro, for the video
@GabeSkorski
@GabeSkorski Жыл бұрын
Nice! Glad my professor showed me this channel :)
@SernaLovesYoongi
@SernaLovesYoongi 6 ай бұрын
The official docs make a lot of sense now after this video. Thnx!
@Greenbay-bn3yk
@Greenbay-bn3yk 9 ай бұрын
Hell yeah!👍 You are the best teacher I've ever found
@swetankraut6065
@swetankraut6065 Жыл бұрын
I must say that this was an EXCEPTIOANALLY great tutorial video..!
@luanolveira6351
@luanolveira6351 Ай бұрын
great video, i finally got to understand what exception handling is
@FootballMania-kc2yi
@FootballMania-kc2yi 2 ай бұрын
Great tutorial, really got to know this concept. Thanks❤
@theamithsingh
@theamithsingh 2 жыл бұрын
As usual, Bro nailed it 💪
@donthiebautable
@donthiebautable 7 ай бұрын
Fun fact: an inability to divide by zero is a myth. Common convention says you can't, and that's fine for most framings, but other conventions involve division by zero to equal either zero or infinity. All three options are 'correct' in their own way, with different advantages and disadvantages to each approach.
@misran449
@misran449 Жыл бұрын
this is the stuff I like on my KZbin feed!! thanks Bro
@wishyouaway
@wishyouaway Жыл бұрын
thank you bro i made the mistake of not putting the input thingys inside the try statements and now i fixed it
@X_habesha
@X_habesha Жыл бұрын
your videos helped me alot, thanks man keep it up :)
@JoseBeltranveles
@JoseBeltranveles Жыл бұрын
Thank you so much! This video helped to understand my homework!!
@casualdomo3202
@casualdomo3202 11 күн бұрын
I hope you know how much of a difference you make for people ❤
@senaustun4380
@senaustun4380 11 ай бұрын
ıdk what to comment but here is one to support you bc you support us big guy
@nasiriqbal5475
@nasiriqbal5475 Жыл бұрын
Bro makes learning coding easy!!!
@LauraAnna-vn7st
@LauraAnna-vn7st 7 ай бұрын
Very easy to understand ....thank you so much😊
@kasmeneyes2227
@kasmeneyes2227 Жыл бұрын
Your youtube channel + Programming for Everybody (Getting Started with Python) on Coursera, the best way to learn Python !
@TheJossephc
@TheJossephc Жыл бұрын
HOW LONG AGO DID YOU TAKE COURSERA'S COURSE?
@JustCoding-c6s
@JustCoding-c6s 6 ай бұрын
your the goat of this generation ;)
@Gladysnjoki
@Gladysnjoki 2 жыл бұрын
You rock...Keep up good work
@piotrkopcewicz5227
@piotrkopcewicz5227 2 жыл бұрын
Pre-eminent tutorial !! Thank You
@ahmedalihenawy7054
@ahmedalihenawy7054 9 ай бұрын
Great way of explaination 😄
@AndreiAcojido
@AndreiAcojido Жыл бұрын
Thank you bro,watching from republic of mindanao
@kapibara2440
@kapibara2440 Жыл бұрын
These videos just cannot be disliked ❤
@vincentb1771
@vincentb1771 Жыл бұрын
Explanations so good I fail NNN from coding euphoria
@thePRECIOUS_1
@thePRECIOUS_1 Жыл бұрын
amazing man this is what i was looking for.
@thorcoder1
@thorcoder1 3 жыл бұрын
You are grateful
@Qustode
@Qustode Жыл бұрын
Nice explanation, thanks for the video
@AryanSachdeva-t5h
@AryanSachdeva-t5h Ай бұрын
Loved the content
@mariamsahak2130
@mariamsahak2130 Жыл бұрын
May God bless you for this!
@vekta-q19
@vekta-q19 3 ай бұрын
Bro Code ,you're the best
@darleyguti1035
@darleyguti1035 2 ай бұрын
excelent video thank you so much
@bharathpavurala7817
@bharathpavurala7817 2 жыл бұрын
Great lecture 🤯
@anuvhabbasu2599
@anuvhabbasu2599 8 ай бұрын
Quality content bro
@tylerhopkins2868
@tylerhopkins2868 2 жыл бұрын
Nice work. Thanks!
@W126-i5u
@W126-i5u Жыл бұрын
Dude YOU ARE THE BEST EVER!!!!
@alphad9474
@alphad9474 3 жыл бұрын
amazing !
@cenpire
@cenpire Ай бұрын
ur the reason im getting my cs degree.
@laurabassino6721
@laurabassino6721 3 жыл бұрын
2:55 the most Dwight Schrute thing I've ever heard 😂
@FaizanShaikh-dq1fs
@FaizanShaikh-dq1fs 3 жыл бұрын
😂😂😂I was going to comment the same, identity theft is not a joke!!!😂
@laurabassino6721
@laurabassino6721 3 жыл бұрын
@@FaizanShaikh-dq1fs Beets, Bears, Battlestar Galactica
@FaizanShaikh-dq1fs
@FaizanShaikh-dq1fs 3 жыл бұрын
@@laurabassino6721 "Micheal Micheal " lol , btw did you complete all python course of bro code?
@laurabassino6721
@laurabassino6721 3 жыл бұрын
@@FaizanShaikh-dq1fs not yet
@gurudathg1328
@gurudathg1328 2 жыл бұрын
@Laura Bassino 🤣🤣
@ilyassbabkhouti
@ilyassbabkhouti Жыл бұрын
good
@PeakPotential766
@PeakPotential766 9 ай бұрын
thanks man you realy are hero for real
@OrhanAhmedov-h7z
@OrhanAhmedov-h7z Жыл бұрын
Absolutely great
@heal294
@heal294 10 ай бұрын
love your vids
@wenbinli9807
@wenbinli9807 Жыл бұрын
very nice class
@GTV_367
@GTV_367 Жыл бұрын
Good vid once again🙂
@Dreamon-np5tb
@Dreamon-np5tb 9 ай бұрын
Much appreciated
@saragh7006
@saragh7006 2 жыл бұрын
I FINALLY CATCH IT THANKKKKS ...
@faresmohamed9447
@faresmohamed9447 7 ай бұрын
i learned a lot, thanks
@sophiawang2400
@sophiawang2400 Жыл бұрын
Thx for teaching 🎉🎉🎉
@b7sh_b7sh
@b7sh_b7sh Жыл бұрын
amazing😍😍
@TenMansVideoOfDemand
@TenMansVideoOfDemand 2 жыл бұрын
Nice Video!
@christianihechi
@christianihechi 9 ай бұрын
Thank you!!
@RyanBalak-z2h
@RyanBalak-z2h 3 жыл бұрын
Duuuude this video was awesome 👌 👏 👍 😍
@dineshgautam7027
@dineshgautam7027 3 жыл бұрын
Thanks.... God bless you....
@kumarmanglam815
@kumarmanglam815 Жыл бұрын
exceptional 😀
@augustinegeorge633
@augustinegeorge633 Жыл бұрын
Bro you are awesome
@arulsingh5741
@arulsingh5741 4 жыл бұрын
Nice
@spartanranger
@spartanranger 3 жыл бұрын
Thanks for the video bro
@matejgrasic4285
@matejgrasic4285 2 жыл бұрын
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
@lw9954
@lw9954 2 жыл бұрын
Thank you Broseph Broestar
@HunaBopa
@HunaBopa Жыл бұрын
Do game developer always put their entire codes inside a try-except-finally block?
@DC-sk8jr
@DC-sk8jr 3 ай бұрын
Thank you! This got to the point for a beginner like me and it was easy to understand and execute, without exception. Also, can I be a sis, rather than a bro?
@agastyaadesh7848
@agastyaadesh7848 3 ай бұрын
What does try keywords do?
@manuela7477
@manuela7477 2 жыл бұрын
Great!
@gurudathg1328
@gurudathg1328 2 жыл бұрын
Is finally block is useful? We can also add a statement in last also
@sadeghkhosravi
@sadeghkhosravi Жыл бұрын
Thanks!!🌷🌷
@gamePlays9699
@gamePlays9699 2 жыл бұрын
NICE!
@johnwarner9102
@johnwarner9102 2 жыл бұрын
great vid!
@mdyusufulhaque9953
@mdyusufulhaque9953 Жыл бұрын
well explained
@HussainAli-sb1dv
@HussainAli-sb1dv Жыл бұрын
love u bro
@kemann3815
@kemann3815 2 жыл бұрын
Thank you!
@yahya_azad
@yahya_azad Жыл бұрын
niceeee😍
@grim-lf6de
@grim-lf6de 3 ай бұрын
If we want to only take the number part when there is an exception, we can say that the user entered the number 21a by mistake. How can we extract only the int part and ignore the string part?
@siciliandragon8654
@siciliandragon8654 Жыл бұрын
I like the "You can't divide by zero! Idiot!" I had just finished typing "You fucked up hard" to print under 'except Exception:'
@Bhupendra7799
@Bhupendra7799 3 жыл бұрын
Thanks bro ❤️
@NiLizee812
@NiLizee812 11 ай бұрын
good tutor bro
@muhammadnasiribrahim723
@muhammadnasiribrahim723 5 ай бұрын
So cool
@BullRun-Insider
@BullRun-Insider 2 ай бұрын
Thanks man
@dagim6625
@dagim6625 Жыл бұрын
Thanks,bro
@techlace1195
@techlace1195 2 жыл бұрын
thx bro
@gamePlays9699
@gamePlays9699 2 жыл бұрын
U r legend!
@tarikyassa1076
@tarikyassa1076 3 жыл бұрын
Thanks bro!
@D.S.MANOJ15
@D.S.MANOJ15 7 ай бұрын
Thanks dude
@ayush118
@ayush118 Жыл бұрын
what is the point of having an "else" statement? because if an error occurred then nothing would be outputted anyways so whats the point
@sajinvithayathil2158
@sajinvithayathil2158 Жыл бұрын
thank you
@afskils107
@afskils107 Жыл бұрын
good teach🍕
#63 Python Tutorial for Beginners | Exception Handling
15:59
Telusko
Рет қаралды 549 М.
Learn Python EXCEPTION HANDLING in 5 minutes! 🚦
5:49
Bro Code
Рет қаралды 18 М.
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
Advanced Exception Handling in Python
12:06
NeuralNine
Рет қаралды 70 М.
While loops in Python are easy ♾️
6:58
Bro Code
Рет қаралды 466 М.
Python Tutorial: Using Try/Except Blocks for Error Handling
10:34
Corey Schafer
Рет қаралды 728 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 275 М.
6 DEVS Make a GAME without COMMUNICATING! (Roblox edition)
15:45
Blackthornprod
Рет қаралды 87 М.
Python inheritance 👪
7:19
Bro Code
Рет қаралды 92 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 716 М.
String methods in Python are easy 〰️
12:06
Bro Code
Рет қаралды 137 М.
Let's code a beginner Python BANKING PROGRAM 💰
15:01
Bro Code
Рет қаралды 354 М.