while True:
b1=input('Type a number:')
try:
a1=int(b1)
except ValueError:
print ('"%(a1)s" is not a number. Try again.' %{'a1':b1})
else:
print ('You typed "{}".'.format(a1))
break
This makes a loop to check whether input is an integer or not, result would look like below:
>>> %Run 1.1.py
Type a number:d
"d" is not a number. Try again.
Type a number:
>>> %Run 1.1.py
Type a number:4
You typed 4.
>>>