What I'm trying to do is ask the user for a type of math operator(Not sure if I used the correct term. I'm new to python.), and use that in place of a math operator in an equation.
Here I tried:
math_thing = int(input('Enter a type of math operator(/,*,+,etc.,)'))
result = 12{0}4.format(math_thing)
print(result)
I was expecting it to ask for a sign, and perform the equation(I was going to add checks to see if it was valid), but what happened was it gave me the error SyntaxError: invalid syntax
.
I don't really know any other way to do it, and when I looked I thought the .format
thing might only work for strings, but I'm not sure.