1whatever = input("Pick an integer > ")
2 try:
3 whatever_as_an_integer = int(whatever)
4 print("That was an integer.")
5
6 except ValueError:
7 print("That is not an integer.")
1user_input = input("Enter something:")
2
3if type(user_input) == int:
4 return user_input
5else:
6 print("Not a number")
1whatever = input("Pick an integer > ")
2try:
3 whatever_as_an_integer = int(whatever)
4 print("That was an integer.")
5
6except ValueError:
7 print("That is not an integer.")
1user_input = input("Enter something:")
2
3if type(user_input) == int:
4 print("Is a number")
5else:
6 print("Not a number")