Last active
December 28, 2015 17:39
-
-
Save zh4ngx/7537472 to your computer and use it in GitHub Desktop.
Simple interview question to test basic debugging & communication skills. May require a live person to answer questions (particularly if the candidate doesn't know Python). TODO: rewrite this in a few languages and put in a repo.
This file contains hidden or 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 foo(a, b): | |
"""Please document me. | |
What am I supposed to do? | |
Rename anything you see fit. | |
Also, I think I have bugs. Please debug me. | |
""" | |
bar = {} | |
for x in a: | |
bar[x] = True | |
for y in a: | |
if bar[b - x]: | |
return True | |
else: | |
return False | |
def test_foo(a, b, c): | |
""" | |
Bonus: Thanks for debugging & documenting me. | |
Please now write unit tests to make sure I behave. | |
Feel free to rename anything here as well. | |
""" | |
# example | |
# assert foo(a,b) == c | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment