Python Input Error || Try and Except || Exception Handling || Python

In this, we are going to see an example of python input error that is done using Exception Handling in Python Programming Language.

# NOTE: Enter a string to see the except statement

try:
    a = int(input("Enter a number: "))
except Exception as e:
    print("Expected int but received string literal")

# Coded by Saahil

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post