+ 1
Given in description
c=input() if str(c)==True: print("alphabet") elif int(c)==True: print("number") elif float(c)==True: print("number") else: print("specified value")
2 odpowiedzi
+ 2
Or just this:
c = input()
try:
float(c)
print("number")
except ValueError: print("alphabet" * c.isalpha() or "specified value")
# Hope this helps
+ 1
c = input()
if c. isalpha():
print("alphabet" )
elif c. isnumeric():
print("number" )
else:
try:
n = float(c)
print("number" )
except ValueError:
print("Not number or alphabet" )
Maybe that helps you
you didn't explain the problem but I guess you might want to check the content of the input and check is alphabet only or number only.
I handle the float by exception there is built in function for cheking the content of string is float or not.