Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def is_rotation(src,dest):
""" here a string s1 is a rotation of another string s2,
by calling (only once) a function is_rotation """

if(src == None or dest == None):
return False
elif(src == "" and dest == ""):
return True
elif(src == "" and dest != ""):
return False
elif(src != "" and dest == ""):
return False
else:
if(len(src) != len(dest)):
return False

for i in range(len(src)):
if dest.startswith(src[i:]) and dest.endswith(src[:i]):
return True
return False
Binary file added build.pyc
Binary file not shown.
Binary file added tests/__init__.pyc
Binary file not shown.
Binary file added tests/test_is_rotation.pyc
Binary file not shown.