You can solve this error by using  Python isdigit() method 4  to check whether the value is number or not. The returns  True  if all the characters are digits, otherwise  False
The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that’s not an integer to the int() function. In other words, it’s either empty or has a character in it other than a digit.