Aug-10-2019, 06:21 AM
I am trying to get this script to only accept integers.
number = int(input("Enter a number. ")) if isinstance(number, str): print("Entry must be a number")I have also tried:
if type(number) is str: print("Entry must be a number")I enter
a
and keep getting:Error:ValueError: invalid literal for int() with base 10: 'a'
Why dosen't this catch the error?