Skip to content

Instantly share code, notes, and snippets.

@nhuntwalker
Last active December 14, 2016 18:53
Show Gist options
  • Save nhuntwalker/44d1c5cf4c619e8f618ca3f6c6003f3a to your computer and use it in GitHub Desktop.
Save nhuntwalker/44d1c5cf4c619e8f618ca3f6c6003f3a to your computer and use it in GitHub Desktop.
Write a function that takes two arguments that are strings
and returns whether or not one is a rotation of the other
word1 = tugboat
word2 =
ttugboa
attugbo
oattugb
boattug
returns True
ugttoab
returns False
TEST_TABLE = [
["tugboat", "boattug", True],
["apple", "pear", False]
]
@pytest.mark.parametrize("one, two, truefalse", TEST_TABLE)
def test_rotations(one, two, truefalse) ...etc
----*------ OR -----*-------
if __name__ == "__main__":
print(rotations("tugboat", "boattug"))
rotations(tugboat, ttugboa)
email: nicholas@codefellows.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment