import operator
ops = {
'+' : operator.add,
'-' : operator.sub,
'*' : operator.mul,
'/' : operator.truediv
}
n = input()
li = [n.split()]
li[0,2,4,6,8] = int(li[0,2,4,6,8])
li[1,3,5,7] = ops(li[1,3,5,7])
print(li)
I used this code above. I took help from Turn string into operator. So what I wanted to do was take in for example:
1 * 3 / 2 * 5 + 1
and split it into a list and then make the operators into operators and all the numbers integers. Then solve it as an equation.