[Solved] Input Mismatch Exception Problem with Python

Input Mismatch Exception: An exception is an unwanted or unexpected event, which occurs during the execution of a program, that disrupts the normal flow of the program. There are many types of exception which can occur due to various reasons. 
 

In this program, when the input is not compatible with the assigned variable, then Input mismatch exception occurs. 

Sample Input and Output 1 :

Enter an integer input5
Entered value is  5

Sample Input and Output 2 :

Enter an integer input5.00
Input Mismatch

Solution

print("Enter an integer input")
try:
    input5 = int(input())
    print("Entered value is {}".format(input5))
except ValueError:

# sauravhathi
    print("Input Mismatch")

Happy Learning – If you require any further information, feel free to contact me.

Share your love
Saurav Hathi

Saurav Hathi

I'm currently studying Bachelor of Computer Science at Lovely Professional University in Punjab.

📌 Nodejs and Android 😎
📌 Java

Articles: 444

Leave a Reply

Your email address will not be published. Required fields are marked *