Given these strings:
\"1 + 2\"
\"apple,pear\"
How can I use Python 3(.5) to determine that the first string contains a math problem and
Simply use split(), then iterate through the list to check if all instance are either numerical values or operational values. Then use eval.
input = "1 + 2"
for i in input.split():
if i in ['+','-','*','%','.'] or i.isdigit():
pass
# do something
else:
pass
# one element is neither a numerical value or operational value