I think the function here is rather canConvertToInt (or can_convert_to_int according to PEP8 😅).
The int(val) works for both val=1 and val="1". If you want simply to test whether a variable is int, type(val)==int should be enough.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think the function here is rather
canConvertToInt
(orcan_convert_to_int
according to PEP8 😅).The
int(val)
works for bothval=1
andval="1"
. If you want simply to test whether a variable is int,type(val)==int
should be enough.