Before rendering a template, a linter checks that every (, [ and { is closed by the matching
bracket in the right order. Other characters are ignored. Return True if the string is balanced.
Implement is_balanced. Input: text: str. Returns: bool.
def is_balanced(text: str) -> bool:
return text.count("(") == text.count(")")
Run executes the public tests. Submit grades against public and hidden tests.
Before rendering a template, a linter checks that every (, [ and { is closed by the matching
bracket in the right order. Other characters are ignored. Return True if the string is balanced.
Implement is_balanced. Input: text: str. Returns: bool.
def is_balanced(text: str) -> bool:
return text.count("(") == text.count(")")
Run executes the public tests. Submit grades against public and hidden tests.