a.isdigit (): для негативов
>>>'-6'.lstrip('-')
'6'
>>>'-6'.lstrip('-').isdigit()
True
Jittery Jay
>>>'-6'.lstrip('-')
'6'
>>>'-6'.lstrip('-').isdigit()
True
def is_digit(n):
try:
int(n)
return True
except ValueError:
return False
if is_digit(question):
....