Remember that
int
will raise a ValueError
if the value passed to it can't be converted to an integer. So, catch the exception and handle it (if you don't know about exception handling with try
and except
, now would be a good time to learn).