Very basic question. We have the code:
a = input("how old are you")
if a == string:
do this
if a == integer (a != string):
do that
Obviously it doesn't work that way. But what is the easiest way to do this. Thanks for any answers in advance.
We could also say:
if string in a:
do this
input
is always going to return a string. What you seem to be looking for is a way to detect whether that string contains digits. Make sure you understand the distinction. – acjohnson55 Jul 3 at 16:48