Created
June 11, 2014 03:00
-
-
Save porterjamesj/75893084a63672c4a8ec to your computer and use it in GitHub Desktop.
fun exercise from programming praxis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def balanced(s): | |
raise NotImplementedError("Implement me!") | |
def test(): | |
for s in ["{}", "[]", "()", "a(b)c", "abc[d]", "a(b)c{d[e]}"]: | |
assert balanced(s) | |
for s in ["{]", "(]", "a(b]c", "abc[d}", "a(b)c{d[e}"]: | |
assert not balanced(s) | |
if __name__ == "__main__": | |
test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment