Sep-24-2018, 11:11 AM
The input is a type str. So you have to convert to type int if you want to. Or you can use isalnum or isdigit methods.
I
I
n [1]: age = '132' In [2]: type(age) Out[2]: str In [3]: age.isalnum() Out[3]: True In [4]: age.isalnum?? Docstring: S.isalnum() -> bool Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise. Type: builtin_function_or_method In [5]: age.isdigit() Out[5]: True In [6]: age.isdigit?? Docstring: S.isdigit() -> bool Return True if all characters in S are digits and there is at least one character in S, False otherwise. Type: builtin_function_or_method In [7]: