Python exception handling ⚠️

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ธ.ค. 2020
  • 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...
    ------------------------------
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 152

  • @BroCodez
    @BroCodez  3 ปีที่แล้ว +46

    # 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
      @arafatmohammadasifbamboowa2211 2 ปีที่แล้ว +1

      Can we use elif instead of except??

    • @macklykyn8967
      @macklykyn8967 2 ปีที่แล้ว +1

      @@arafatmohammadasifbamboowa2211 I don't think so, cause you can't print what kind of exception

    • @ghobashi2000
      @ghobashi2000 ปีที่แล้ว +3

      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

  • @KarinFields
    @KarinFields 8 หลายเดือนก่อน +9

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

  • @passportbro904
    @passportbro904 ปีที่แล้ว +26

    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 ❤

  • @TheWeirdTeenager2010
    @TheWeirdTeenager2010 4 หลายเดือนก่อน +3

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

  • @elliotradley4370
    @elliotradley4370 ปีที่แล้ว +12

    Always great tutorials, never stop making excellent tutorials

  • @Engmelli
    @Engmelli 2 ปีที่แล้ว +31

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

    • @damansomaiah6535
      @damansomaiah6535 7 หลายเดือนก่อน +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
      @2bfrank657 2 หลายเดือนก่อน

      ​@@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 หลายเดือนก่อน +1

      Or you are not supposed to know, that might be bad for their PR

  • @user-mg4kw8zp4p
    @user-mg4kw8zp4p 11 หลายเดือนก่อน +1

    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

  • @BeanieK1
    @BeanieK1 4 หลายเดือนก่อน

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

  • @shriniketkulkarni8169
    @shriniketkulkarni8169 9 หลายเดือนก่อน +3

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

  • @user-os5ky3zh8r
    @user-os5ky3zh8r 3 หลายเดือนก่อน

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

  • @Greenbay-bn3yk
    @Greenbay-bn3yk 2 หลายเดือนก่อน

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

  • @piotrkopcewicz5227
    @piotrkopcewicz5227 2 ปีที่แล้ว +1

    Pre-eminent tutorial !! Thank You

  • @htetmyetthar5650
    @htetmyetthar5650 2 หลายเดือนก่อน

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

  • @GabeSkorski
    @GabeSkorski 6 หลายเดือนก่อน +1

    Nice! Glad my professor showed me this channel :)

  • @X_habesha
    @X_habesha 6 หลายเดือนก่อน

    your videos helped me alot, thanks man keep it up :)

  • @theamithsingh
    @theamithsingh ปีที่แล้ว +5

    As usual, Bro nailed it 💪

  • @AD-cc7bj
    @AD-cc7bj 4 หลายเดือนก่อน

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

  • @user-fh1uz3gn3r
    @user-fh1uz3gn3r ปีที่แล้ว +1

    Thank you so much! This video helped to understand my homework!!

  • @swetankraut6065
    @swetankraut6065 6 หลายเดือนก่อน

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

  • @tylerhopkins2868
    @tylerhopkins2868 2 ปีที่แล้ว +1

    Nice work. Thanks!

  • @misran449
    @misran449 9 หลายเดือนก่อน

    this is the stuff I like on my TH-cam feed!! thanks Bro

  • @LauraAnna-vn7st
    @LauraAnna-vn7st หลายเดือนก่อน

    Very easy to understand ....thank you so much😊

  • @Qustode
    @Qustode ปีที่แล้ว

    Nice explanation, thanks for the video

  • @SernaLovesYoongi
    @SernaLovesYoongi 8 วันที่ผ่านมา

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

  • @Gladysnjoki
    @Gladysnjoki ปีที่แล้ว +2

    You rock...Keep up good work

  • @ahmedalihenawy7054
    @ahmedalihenawy7054 3 หลายเดือนก่อน

    Great way of explaination
    😄

  • @alphad9474
    @alphad9474 2 ปีที่แล้ว +2

    amazing !

  • @bharathpavurala7817
    @bharathpavurala7817 ปีที่แล้ว +1

    Great lecture 🤯

  • @heal294
    @heal294 4 หลายเดือนก่อน

    love your vids

  • @user-me7tt8uz9b
    @user-me7tt8uz9b 9 หลายเดือนก่อน

    Absolutely great

  • @thorcoder1
    @thorcoder1 3 ปีที่แล้ว +2

    You are grateful

  • @christianihechi
    @christianihechi 3 หลายเดือนก่อน

    Thank you!!

  • @senaustun4380
    @senaustun4380 5 หลายเดือนก่อน

    ıdk what to comment but here is one to support you bc you support us big guy

  • @thePRECIOUS_1
    @thePRECIOUS_1 6 หลายเดือนก่อน

    amazing man this is what i was looking for.

  • @Dreamon-np5tb
    @Dreamon-np5tb 3 หลายเดือนก่อน

    Much appreciated

  • @somthing7286
    @somthing7286 10 หลายเดือนก่อน

    thank you bro i made the mistake of not putting the input thingys inside the try statements and now i fixed it

  • @kemann3815
    @kemann3815 2 ปีที่แล้ว

    Thank you!

  • @starplatinum6181
    @starplatinum6181 2 ปีที่แล้ว

    Nice Video!

  • @leinadpq9527
    @leinadpq9527 ปีที่แล้ว +2

    finally, a video that is easy to understand.

  • @anuvhabbasu2599
    @anuvhabbasu2599 2 หลายเดือนก่อน

    Quality content bro

  • @nasiriqbal5475
    @nasiriqbal5475 9 หลายเดือนก่อน +1

    Bro makes learning coding easy!!!

  • @spartanranger
    @spartanranger 3 ปีที่แล้ว

    Thanks for the video bro

  • @user-by7zz7gm3c
    @user-by7zz7gm3c 3 หลายเดือนก่อน

    Thanks bro!

  • @sadeghkhosravi
    @sadeghkhosravi ปีที่แล้ว

    Thanks!!🌷🌷

  • @mariamsahak2130
    @mariamsahak2130 7 หลายเดือนก่อน

    May God bless you for this!

  • @faresmohamed9447
    @faresmohamed9447 หลายเดือนก่อน

    i learned a lot, thanks

  • @manuela7477
    @manuela7477 ปีที่แล้ว

    Great!

  • @johnwarner9102
    @johnwarner9102 ปีที่แล้ว

    great vid!

  • @One_piece1089
    @One_piece1089 7 หลายเดือนก่อน

    amazing😍😍

  • @GTV_367
    @GTV_367 11 หลายเดือนก่อน

    Good vid once again🙂

  • @sophiawang2400
    @sophiawang2400 ปีที่แล้ว

    Thx for teaching
    🎉🎉🎉

  • @matejgrasic4285
    @matejgrasic4285 ปีที่แล้ว +1

    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

  • @arulsingh5741
    @arulsingh5741 3 ปีที่แล้ว +1

    Nice

  • @PeakPotential766
    @PeakPotential766 3 หลายเดือนก่อน

    thanks man you realy are hero for real

  • @AndreiAcojido
    @AndreiAcojido 5 หลายเดือนก่อน

    Thank you bro,watching from republic of mindanao

  • @divinityinversace
    @divinityinversace ปีที่แล้ว

    tysm so helpful for a beginner

  • @wenbinli9807
    @wenbinli9807 6 หลายเดือนก่อน

    very nice class

  • @dineshgautam7027
    @dineshgautam7027 3 ปีที่แล้ว

    Thanks.... God bless you....

  • @Mutable7
    @Mutable7 2 ปีที่แล้ว +1

    Thanks bro ❤️

  • @kapibara2440
    @kapibara2440 9 หลายเดือนก่อน

    These videos just cannot be disliked ❤

  • @user-yr8qs7fm7o
    @user-yr8qs7fm7o ปีที่แล้ว

    Dude YOU ARE THE BEST EVER!!!!

  • @gamePlays9699
    @gamePlays9699 ปีที่แล้ว

    NICE!

  • @yahyaazad2990
    @yahyaazad2990 11 หลายเดือนก่อน

    niceeee😍

  • @kumarmanglam815
    @kumarmanglam815 9 หลายเดือนก่อน

    exceptional 😀

  • @dagim6625
    @dagim6625 6 หลายเดือนก่อน

    Thanks,bro

  • @user-ps2fq4vu2k
    @user-ps2fq4vu2k 2 ปีที่แล้ว

    Duuuude this video was awesome 👌 👏 👍 😍

  • @DanielHai-ow3km
    @DanielHai-ow3km หลายเดือนก่อน

    Yo bro cool vid

  • @mdyusufulhaque9953
    @mdyusufulhaque9953 ปีที่แล้ว

    well explained

  • @iknowyoureawesome693
    @iknowyoureawesome693 หลายเดือนก่อน

    Thanks dude

  • @altanbengiler8315
    @altanbengiler8315 2 ปีที่แล้ว

    Good job broo :)

  • @vincentb1771
    @vincentb1771 8 หลายเดือนก่อน

    Explanations so good I fail NNN from coding euphoria

  • @augustinegeorge633
    @augustinegeorge633 ปีที่แล้ว

    Bro you are awesome

  • @scottjeffery4583
    @scottjeffery4583 3 หลายเดือนก่อน

    Thanks

  • @shawkir35
    @shawkir35 7 หลายเดือนก่อน

    Thanks bro

  • @sajinvithayathil2158
    @sajinvithayathil2158 9 หลายเดือนก่อน

    thank you

  • @user-vr2si8on9f
    @user-vr2si8on9f 11 หลายเดือนก่อน +1

    good

  • @Dreamon-np5tb
    @Dreamon-np5tb 3 หลายเดือนก่อน

    Thanks Bro

  • @lw9954
    @lw9954 ปีที่แล้ว

    Thank you Broseph Broestar

  • @gamePlays9699
    @gamePlays9699 ปีที่แล้ว

    U r legend!

  • @NiLizee812
    @NiLizee812 5 หลายเดือนก่อน

    good tutor bro

  • @user-xk7de1jw8g
    @user-xk7de1jw8g ปีที่แล้ว +1

    Do game developer always put their entire codes inside a try-except-finally block?

  • @airlanggak5391
    @airlanggak5391 3 ปีที่แล้ว

    thanks !

  • @saragh7006
    @saragh7006 2 ปีที่แล้ว +1

    I FINALLY CATCH IT THANKKKKS ...

  • @gurudathg1328
    @gurudathg1328 2 ปีที่แล้ว

    Is finally block is useful?
    We can also add a statement in last also

  • @uuhju7004
    @uuhju7004 3 ปีที่แล้ว

    ty

  • @kasmeneyes2227
    @kasmeneyes2227 ปีที่แล้ว +1

    Your youtube channel + Programming for Everybody (Getting Started with Python) on Coursera, the best way to learn Python !

    • @TheJossephc
      @TheJossephc 11 หลายเดือนก่อน

      HOW LONG AGO DID YOU TAKE COURSERA'S COURSE?

  • @beingzero7541
    @beingzero7541 2 ปีที่แล้ว

    Wow!

  • @tariq_lib
    @tariq_lib 4 หลายเดือนก่อน

    thanks

  • @techlace1195
    @techlace1195 ปีที่แล้ว

    thx bro

  • @HussainAli-sb1dv
    @HussainAli-sb1dv 9 หลายเดือนก่อน

    love u bro

  • @michalski9141
    @michalski9141 2 ปีที่แล้ว

    How would I make it say that {whatever you typed in} is not a number

  • @afskils107
    @afskils107 ปีที่แล้ว

    good teach🍕

  • @Tk_the_0ne
    @Tk_the_0ne 7 หลายเดือนก่อน

    bro is cooking man

  • @maddulavk332
    @maddulavk332 5 หลายเดือนก่อน

    tq

  • @anurashik7584
    @anurashik7584 10 หลายเดือนก่อน

    thank you........

  • @hungnguyentien1223
    @hungnguyentien1223 2 หลายเดือนก่อน

    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?

  • @user-dv7mr6mu7w
    @user-dv7mr6mu7w 6 หลายเดือนก่อน

    The best

  • @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

  • @laopichthyrith2490
    @laopichthyrith2490 ปีที่แล้ว

    Bro so underrated

  • @tonnyjarvis6770
    @tonnyjarvis6770 ปีที่แล้ว

    thanks gain