Your question is Balanced Brackets Validator. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Noblis software may receive compact configuration or message fragments containing parentheses and square brackets. Implement a method that determines whether every opening delimiter is closed by the correct delimiter in the correct order.
A string is valid when each ( has a matching ), each [ has a matching ], and delimiters are properly nested. Ignore all characters other than (, ), [, and ].
Implement is_balanced(s), where s is a string. Return True if the relevant delimiters are balanced and properly nested; otherwise, return False. The empty string is considered valid.
def is_balanced(s):