Question: Python program Create a program that will take a string input from a user to check for the max depth of nested parenthesis given within
Python program Create a program that will take a string input from a user to check for the max depth of nested parenthesis given within that string. The max depth will be returned as an integer. Condition for the string input is to expect the user to input only a mix of integer values, parenthesis ) or ( and operators (+,-,=,/,*), no error checking is necessary on the programmers` side. Inputs with only parenthesis are also valid such as () () and ()(()()), these inputs would have a maximum nested depth of 1 and 2 respectively, whereas input such as )( and ((() would not be valid and have a depth of zero (as they are not properly nested) Further examples on next slide.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
