Duration 7:39

Python exception handling ️

33 588 watched
0
2.3 K
Published 21 Dec 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 https://soundcloud.com/kubbi Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0 Free Download / Stream: http://bit.ly/2JnDfCE Music promoted by Audio Library /watch/INo64jBxeDtx6 ––––––––––––––––––––––––––––––

Category

Show more

Comments - 105