I\'ve written the following code in Python 3.x to validate the user\'s input:
while True: try: answer = int(input(\"Enter an integer: \")) except
String, everything that you input() will be a string. And all of them will raise value error except for C-c if int() raises it.
input()
C-c
int()