nick34992 of Python
2/2/2017 - 7:23 AM

Error Handling: Integer Entry

Error Handling: Integer Entry

#!/usr/bin/env python3

i = None
err = "Invalid entry!"
s = input("Enter any integer: ")
try:
    i = int(s)
    print("Valid integer", i, "was entered.")
except:
    print(err)