Write a Python program to read integers only by handing the ValueError Exception.
Problem Solution: In the program, we are reading an integer using int(input()) from the user and handling the expectation by using the try and expect statement.
When the user inputs a value other than an integer, the program will generate ValueError and in the program, ValueError is being handled using the "except ValueError:" block.
Python program to handle ValueError expectation
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer