logo CodeStepByStep logo


Language/Type: Python string parameters return boolean

Write a function named is_rotation that accepts two strings as parameters and returns true if they are rotations of each other. Two strings are considered rotations if they contain the same characters in the same relative order when wrapped around. For example, the call of is_rotation("abcde", "deabc") should return True. The call of is_rotation("abcde", "edcba") should return False because the characters are not in the same order. A string is also considered to be its own rotation.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.