Exception Handling in Python | TRY EXCEPT in Python | Python Tutorial for Beginners #8

Поделиться
HTML-код
  • Опубликовано: 28 июл 2024
  • Exception Handling in Python can be done using try except in python. Handling exceptions is one of the most important aspects of a good python program hence in python we can handle exceptions by placing the block of code which we assume to be causing error inside a try and except block.
    Any error caused by the block of code within the try except clause won’t be returned to the user but will be handled by the except block.
    In Python, we can also raise user defined exceptions using the raise Exception clause. Raise exception can be used anywhere in the code to cause an error based on certain conditions.
    We can raise and exception within the try except block so the user defined error can be caught by the try except block.
    Within try except exception handling in python, we can also use ELSE and FINALLY clause. Block of code within else will be executed when the code within try does not throw an error. If the block of code within try causes an exception, then the except block will be called and the block of code within except will be executed.
    Block of code within finally, will be executed every time. Meaning whether there is an exception or not, if you have mentioned finally in your try exception block then the block of code within finally will always be executed.
    This video is aimed at complete beginners who are just getting started with programming or with python programming. The concepts are explaining in the most basic manner so anyone can understand it.
    The purpose of this Python tutorial series for beginners is to explain python programming in the most simplest manner by providing simple examples and working out interesting and meaningful python programs which should be a better way to learn programming especially for the beginners.
    All the programs and content of this video will be posted in my website techtfq.com/
    So please make sure to check that out as well.
    Other video’s in this tutorial series:
    Local and Global Scope in Python | Local and Global Variables | Python Tutorial for Beginners #7
    • Local and Global Scope...
    What is a FUNCTION in Python | Python Functions | Python Tutorial for Beginners #6
    • What is a FUNCTION in ...
    Import modules in Python | Import module from different directory | Python Tutorial for Beginners #5
    • Import modules in Pyth...
    WHILE loop and FOR loop in Python | LOOP statements in Python | Python Tutorial for Beginners #4
    • WHILE loop and FOR loo...
    IF ELSE ELIF statement in Python | IF ELSE Statement in Python | Python Tutorial for Beginners #3
    • IF ELSE ELIF statement...
    What is a VARIABLE in Python | Python Variables | Python Tutorial for Beginners #2
    • What is a VARIABLE in ...
    What are DATA TYPE, OPERATORS and EXPRESSION in Python | Python Tutorial for Absolute Beginners #1
    • What is DATA TYPE, OPE...
    Please like, subscribe and leave a comment if you found the video to be useful. Also please make sure to click on the notification bell to be notified of my latest video’s.
    🔴 WATCH MORE VIDEOS HERE 👇
    ✅ SQL Tutorial - Basic concepts:
    • SQL Tutorial - Basic c...
    ✅ SQL Tutorial - Intermediate concepts:
    • SQL Tutorial - Interme...
    ✅ SQL Tutorial - Advance concepts:
    • SQL Tutorial - Advance...
    ✅ Practice Solving Basic SQL Queries:
    • Practice Solving BASIC...
    ✅ Practice Solving Intermediate SQL Queries:
    • Practice Solving INTER...
    ✅ Practice Solving Complex SQL Queries:
    • Practice Solving COMPL...
    ✅ Data Analytics Career guidance:
    • Data Analytics career ...
    ✅ SQL Course, SQL Training Platform Recommendations:
    • SQL Course / Training
    ✅ Python Tutorial:
    • Python Tutorial
    ✅ Git and GitHub Tutorial:
    • Git and GitHub
    ✅ Data Analytics Projects:
    • Data Analytics Projects
    THANK YOU,
    Thoufiq

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

  • @girishnaveen9059
    @girishnaveen9059 3 года назад +11

    I was looking for python tutorials masterclass But found on RUclips Yours is one of the clear and easy to follow

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

      Thank you so much for the positive feedback.. much appreciated 🙂

  • @1cookgs
    @1cookgs Месяц назад

    Excellent presentation! Thank you for all the good help.

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

    Fantastic explanation for new programmers. Thank you!

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

    Thank you for making this so easy to understand!

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

    How you re given such clear information shortly with optimised example great work thank u for the video

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

    SQL learnt from your videos only again started python sir thank u for the teaching sir

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

    Very well explained, sir .. Thank you

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

    Nam tu tu tu 😂 good job man!

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

    Thank u ..sir u cleared my doubt

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

    so well explained!

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

    Very well explained

  • @R_SinghRajput
    @R_SinghRajput 21 день назад

    Nice Explanation , Tysm BRO

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

    Keep up the great work👍 You are doing fab👌Investing your time in sharing your knowledge👌

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

    Thanks Sir

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

    U made this topic so easy 4 me. Thanks

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

      Thank you 🙏🏼
      I am glad to read this

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

    Hi, what if I pass three arguments from the function call like add(10,20,30) and how can I handle this.
    Thanks in advance.

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

    very nice

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

      Thank you 🙏🏼

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

    Thoufiq Sir,
    In the example given at 12:00 Mins, the program won't ever go to "except part"....
    So is it given as a mandatory variable to be passed in try & except case???

  • @amyyyy58
    @amyyyy58 28 дней назад

    I have a question:
    6:00 If we have default Exception to handle exceptions then why do we need to explicitly handle each exceptions? We can simply use the default one
    Is it because to improve performance of code or simply to have personalized error message?
    Thanks

  • @Basket-hb5jc
    @Basket-hb5jc 3 месяца назад

    11:00 -> raise exception to give custom exception message

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

    why the same code gives me 'none ' after every print(function()) statement

    • @SawaschaiChavanakorn-oh8zw
      @SawaschaiChavanakorn-oh8zw 3 месяца назад

      Hi! in case you still looking for an answer. The so called 'output' of a function is always "none", as long as you don't manipulate the return. In this video, he sometimes wrote block of code in his function print(), therefore return remains "none". If you want to print the summation you may try:
      def addNum(num1, num2):
      return(num1 + num2)
      print(addNum(1, 2))

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

    Thanks sir