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.