Prep Problem - 10

When you write mathematical expressions, as well as lines of code in python, it is important to keep your parentheses balanced. For every open parenthesis, (, there must be a matching closed parenthesis, ). For instance, these math expressions have unbalanced parentheses:

However, these have balanced parentheses:

You should write a program that takes a string as input, and determines if the parentheses are balanced or not. You can use a while-loop to determine this. While looping through the characters, keep track of how many closed and open parentheses you see. If either of the below conditions is met, that indicates unbalanced parentheses:

Some examples:

Enter string:
5 + (4 * (3 + (5 + 5)))
Parentheses balanced
Enter string:
(()))((((())))
Parentheses unbalanced

Name the program prep10.py. Make sure that gradescope gives you the points for passing the test case.