0
The input is symbol or number
function or method for finding out whether the input from the string is symbol on number in Python3 for example s = input("some string") # s = "5+6*/" need such a result 5 Number + Symbol(or something like that) 6 Number * Symbol / Symbol
3 Answers
+ 4
Here is an example:
https://code.sololearn.com/cMHlPe48AWz8/?ref=app
+ 4
So, take the string, break it apart, and try and cast each one to an int? I'm not sure if this would work in python or not.
+ 2
a = input()
for x in a:
try:
print(int(x)*''+str(x)+' is a number')
except ValueError:
print(x, 'is a literal')