Python exception handling ⚠️

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024
  • 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...
    ------------------------------

Комментарии • 155

  • @BroCodez
    @BroCodez  3 года назад +48

    # 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 9 месяцев назад +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 6 месяцев назад +4

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

  • @Engmelli
    @Engmelli 2 года назад +32

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

    • @damansomaiah6535
      @damansomaiah6535 8 месяцев назад +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 3 месяца назад

      ​@@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 2 месяца назад +1

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

  • @shriniketkulkarni8169
    @shriniketkulkarni8169 10 месяцев назад +3

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

  • @elliotradley4370
    @elliotradley4370 Год назад +12

    Always great tutorials, never stop making excellent tutorials

  • @SernaLovesYoongi
    @SernaLovesYoongi Месяц назад

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

  • @GabeSkorski
    @GabeSkorski 7 месяцев назад +1

    Nice! Glad my professor showed me this channel :)

  • @user-mg4kw8zp4p
    @user-mg4kw8zp4p Год назад +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 5 месяцев назад

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

  • @htetmyetthar5650
    @htetmyetthar5650 3 месяца назад

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

  • @AD-cc7bj
    @AD-cc7bj 6 месяцев назад

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

  • @user-os5ky3zh8r
    @user-os5ky3zh8r 4 месяца назад

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

  • @LauraAnna-vn7st
    @LauraAnna-vn7st 2 месяца назад

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

  • @theamithsingh
    @theamithsingh Год назад +5

    As usual, Bro nailed it 💪

  • @ahmedalihenawy7054
    @ahmedalihenawy7054 4 месяца назад

    Great way of explaination
    😄

  • @swetankraut6065
    @swetankraut6065 7 месяцев назад

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

  • @Greenbay-bn3yk
    @Greenbay-bn3yk 4 месяца назад

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

  • @user-fh1uz3gn3r
    @user-fh1uz3gn3r Год назад +1

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

  • @Gladysnjoki
    @Gladysnjoki Год назад +2

    You rock...Keep up good work

  • @somthing7286
    @somthing7286 11 месяцев назад

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

  • @nasiriqbal5475
    @nasiriqbal5475 10 месяцев назад +1

    Bro makes learning coding easy!!!

  • @leinadpq9527
    @leinadpq9527 Год назад +2

    finally, a video that is easy to understand.

  • @kasmeneyes2227
    @kasmeneyes2227 Год назад +1

    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?

  • @senaustun4380
    @senaustun4380 6 месяцев назад

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

  • @AndreiAcojido
    @AndreiAcojido 6 месяцев назад

    Thank you bro,watching from republic of mindanao

  • @user-dl4ks1mg5j
    @user-dl4ks1mg5j Месяц назад

    your the goat of this generation ;)

  • @piotrkopcewicz5227
    @piotrkopcewicz5227 2 года назад +1

    Pre-eminent tutorial !! Thank You

  • @misran449
    @misran449 10 месяцев назад

    this is the stuff I like on my RUclips feed!! thanks Bro

  • @vincentb1771
    @vincentb1771 9 месяцев назад

    Explanations so good I fail NNN from coding euphoria

  • @user-yr8qs7fm7o
    @user-yr8qs7fm7o Год назад

    Dude YOU ARE THE BEST EVER!!!!

  • @anuvhabbasu2599
    @anuvhabbasu2599 3 месяца назад

    Quality content bro

  • @X_habesha
    @X_habesha 7 месяцев назад

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

  • @divinityinversace
    @divinityinversace Год назад

    tysm so helpful for a beginner

  • @bharathpavurala7817
    @bharathpavurala7817 Год назад +1

    Great lecture 🤯

  • @PeakPotential766
    @PeakPotential766 4 месяца назад

    thanks man you realy are hero for real

  • @tylerhopkins2868
    @tylerhopkins2868 2 года назад +1

    Nice work. Thanks!

  • @Qustode
    @Qustode Год назад

    Nice explanation, thanks for the video

  • @heal294
    @heal294 5 месяцев назад

    love your vids

  • @mariamsahak2130
    @mariamsahak2130 9 месяцев назад

    May God bless you for this!

  • @Dreamon-np5tb
    @Dreamon-np5tb 4 месяца назад

    Much appreciated

  • @saragh7006
    @saragh7006 2 года назад +1

    I FINALLY CATCH IT THANKKKKS ...

  • @faresmohamed9447
    @faresmohamed9447 2 месяца назад

    i learned a lot, thanks

  • @One_piece1089
    @One_piece1089 8 месяцев назад

    amazing😍😍

  • @thorcoder1
    @thorcoder1 3 года назад +2

    You are grateful

  • @kapibara2440
    @kapibara2440 10 месяцев назад

    These videos just cannot be disliked ❤

  • @wenbinli9807
    @wenbinli9807 7 месяцев назад

    very nice class

  • @laurabassino6721
    @laurabassino6721 3 года назад +3

    2:55 the most Dwight Schrute thing I've ever heard 😂

    • @FaizanShaikh-dq1fs
      @FaizanShaikh-dq1fs 3 года назад +1

      😂😂😂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 🤣🤣

  • @lw9954
    @lw9954 2 года назад

    Thank you Broseph Broestar

  • @thePRECIOUS_1
    @thePRECIOUS_1 8 месяцев назад

    amazing man this is what i was looking for.

  • @christianihechi
    @christianihechi 4 месяца назад

    Thank you!!

  • @alphad9474
    @alphad9474 2 года назад +2

    amazing !

  • @donthiebautable
    @donthiebautable 2 месяца назад

    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.

  • @kumarmanglam815
    @kumarmanglam815 10 месяцев назад

    exceptional 😀

  • @sadeghkhosravi
    @sadeghkhosravi Год назад

    Thanks!!🌷🌷

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

  • @sophiawang2400
    @sophiawang2400 Год назад

    Thx for teaching
    🎉🎉🎉

  • @user-me7tt8uz9b
    @user-me7tt8uz9b 11 месяцев назад

    Absolutely great

  • @arulsingh5741
    @arulsingh5741 3 года назад +1

    Nice

  • @user-by7zz7gm3c
    @user-by7zz7gm3c 4 месяца назад

    Thanks bro!

  • @user-vr2si8on9f
    @user-vr2si8on9f Год назад +1

    good

  • @muhammadnasiribrahim723
    @muhammadnasiribrahim723 22 дня назад

    So cool

  • @NiLizee812
    @NiLizee812 6 месяцев назад

    good tutor bro

  • @Tk_the_0ne
    @Tk_the_0ne 9 месяцев назад

    bro is cooking man

  • @dagim6625
    @dagim6625 7 месяцев назад

    Thanks,bro

  • @yahyaazad2990
    @yahyaazad2990 Год назад

    niceeee😍

  • @dineshgautam7027
    @dineshgautam7027 3 года назад

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

  • @GTV_367
    @GTV_367 Год назад

    Good vid once again🙂

  • @spartanranger
    @spartanranger 3 года назад

    Thanks for the video bro

  • @augustinegeorge633
    @augustinegeorge633 Год назад

    Bro you are awesome

  • @DanielHai-ow3km
    @DanielHai-ow3km 2 месяца назад

    Yo bro cool vid

  • @D.S.MANOJ15
    @D.S.MANOJ15 2 месяца назад

    Thanks dude

  • @Mutable7
    @Mutable7 2 года назад +1

    Thanks bro ❤️

  • @user-ps2fq4vu2k
    @user-ps2fq4vu2k 2 года назад

    Duuuude this video was awesome 👌 👏 👍 😍

  • @shawkir35
    @shawkir35 8 месяцев назад

    Thanks bro

  • @laopichthyrith2490
    @laopichthyrith2490 Год назад

    Bro so underrated

  • @sajinvithayathil2158
    @sajinvithayathil2158 10 месяцев назад

    thank you

  • @scottjeffery4583
    @scottjeffery4583 4 месяца назад

    Thanks

  • @afskils107
    @afskils107 Год назад

    good teach🍕

  • @gamePlays9699
    @gamePlays9699 Год назад

    NICE!

  • @shavindasilva
    @shavindasilva 2 года назад +1

    something went right👌

  • @gamePlays9699
    @gamePlays9699 Год назад

    U r legend!

  • @kemann3815
    @kemann3815 2 года назад

    Thank you!

  • @riceball7238
    @riceball7238 8 месяцев назад

    thanks for this video 58 more videos to go

  • @starplatinum6181
    @starplatinum6181 2 года назад

    Nice Video!

  • @Bro_Trade
    @Bro_Trade 8 месяцев назад

    print("You are a legend")

  • @mdyusufulhaque9953
    @mdyusufulhaque9953 Год назад

    well explained

  • @johnwarner9102
    @johnwarner9102 Год назад

    great vid!

  • @hakanerenaykac1742
    @hakanerenaykac1742 Год назад

    print("Thank you Bro Code")

  • @manuela7477
    @manuela7477 Год назад

    Great!

  • @anurashik7584
    @anurashik7584 11 месяцев назад

    thank you........

  • @HussainAli-sb1dv
    @HussainAli-sb1dv 10 месяцев назад

    love u bro

  • @user-dv7mr6mu7w
    @user-dv7mr6mu7w 7 месяцев назад

    The best

  • @techlace1195
    @techlace1195 2 года назад

    thx bro

  • @xeurek4
    @xeurek4 7 месяцев назад

    Bro code for life

  • @maddulavk332
    @maddulavk332 6 месяцев назад

    tq

  • @altanbengiler8315
    @altanbengiler8315 2 года назад

    Good job broo :)

  • @user-ek4wq2fl7c
    @user-ek4wq2fl7c Год назад

    hi mam ela vunavu

  • @airlanggak5391
    @airlanggak5391 3 года назад

    thanks !