Question: f tion IMPORTANT: For this exercise, you will be defining a function which USES the Stack ADT. A stack implementation is provided to you as

 f tion IMPORTANT: For this exercise, you will be defining a

f tion IMPORTANT: For this exercise, you will be defining a function which USES the Stack ADT. A stack implementation is provided to you as part of this exercise - you should not define your own Stack class. Instead, your code can make use of any of the Stack ADT methods: Stack().push(), pop(), peek(), size() and is_empty(). Write a function called is_balanced_brackets(text) which takes a string as a parameter and returns a Boolean. The function checks whether brackets are correctly balanced. There are three different types of brackets: round brackets ( ) square brackets [ ] and curly brackets (). The function should return True if every opening bracket is matched by an appropriately-placed closing bracket of the same type, and False otherwise. Note: you can assume that an implementation of the Stack ADT is given and the parameter string is not empty. For example: Test Result print(is_balanced_brackets('{{x})(010')) True print(is_balanced_brackets('x(y)z')) True print(is_balanced_brackets('(x)](0)0')) False print(is balanced_brackets(x[y)(1z:)) False Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!