πAlso known as exceptions.
While executing the program if something goes wrong because of end user input or programming logic or memory problems,then we will get Runtime Errors.
Ex: print(10/0)
==>Zero DivisionError: division by zero
print(10/"ten")
==>TypeError: unsupported operand type(s) for /: 'int' and 'str'
x=int(input("Enter Number:"))
print(x)
D:\Python3>py Excep.py
Enter Number:ten
ValueError: invalid literal for int() with base 10: 'ten'
✅Note: Exception Handling concept applicable for Runtime Errors but not for syntax errors.

No comments:
Post a Comment
Thank you Very Much.For Given Comment