I have a list that contains a calculation
list = ['(', '1', '+', '(', '2', '*', '3', ')', ')']
and my goal is to solve it. The answer is 7, but how can I write a code to calculate it for me? I've tried to convert the list to a string and then make it an integer so that Python would calculate it like a regular calculation but I've figured that it doesn't work like that.
a = int(''.join(list)) # this doesn't work
In other words, I'd like to convert it to this form so that Python could calculate it.
a = (1+(2*3))
print(a) # 7
Is there any easy way to solve this in Python?