Please complete this assignment and submit in a python file, name it p5.py and implement expression evaluator using Python. The input text files t5*.dat should be at the same directory with your p5.py file. Each input file has only one expression consists of positive integers, whitespaces like space (‘ ‘) or tab, add (‘+’), multiply (‘*’), open parenthesis (‘(‘), and close parenthesis (‘)’). If input contains any other characters or imbalanced open and close parenthesis, your p5 should report e
or and handle the next input file if there is one. The parenthesis has the highest precedence, the * is second highest, and + is the lowest. Since you read input as a character string, you need to convert numbers to integer by int(). If the input is a legal expression, your p5 should output co
ect answer for the expression.
Â
Example input and output:
t50.dat:
2*(5+3*3)
The output for t50.dat should be 28
t51.dat:
(1 + 2 * (51Â Â Â Â Â Â Â Â Â Â Â Â Â + 3 * 3)) * XXXXXXXXXX
The output for t51 should be 1562
t59.dat:
(1+a)) + 1 * ((2)
Your p5 should report e
or and handle next input file.