+ 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")

13th Aug 2021, 2:54 AM
Satyaban
Satyaban - avatar
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
13th Aug 2021, 7:29 AM
Calvin Thomas
Calvin Thomas - avatar
+ 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.
13th Aug 2021, 6:08 AM
Mehrdad Sh
Mehrdad Sh - avatar