try:     value=int(input("Type a number:")) except ValueError:     print("This is not a whole number.") 

Read more of this post