python
beginner
已解决
2026-11-17 结束
Balanced brackets
Write is_balanced(text) that returns True when every (, [ and { in the text is closed by the matching bracket in the right order.
- Other characters are ignored, so
"print(items[0])"is balanced. "(]"and"(()"are not.
Acceptance criteria
- An empty string is balanced.
- The tests at the bottom print
All tests passed.
Hint: a stack (a Python list) is all you need.
目前已有 0 人解出。
编辑器Ctrl + Enter
当测试输出 "All tests passed" 时,此挑战会在本浏览器中标记为已解决。
提交您的解决方案进行审核