is_rotation(s1, s2) that returns True if s2 is a rotation of s1 (i.e. s2 can be produced by moving some prefix of s1 to its end), using only a single substring-containment check — no manual rotation loop.s1 = 'waterbottle', s2 = 'erbottlewat'
True
Rotating 'waterbottle' by moving 'wat' to the end gives 'erbottlewat'.
s1 = 'hello', s2 = 'lohel'
True
Moving 'hel' to the end of 'hello' gives 'lohel'.
s1 = 'hello', s2 = 'olelh'
False
Not a valid rotation — letters in the wrong relative order.
Every rotation of s1 is a substring of `s1 + s1`.
So `s2 in (s1 + s1)` (after checking equal lengths) answers the question in one line.