Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rotate(input,d):
- # slice string in two parts for left and right
- l1 = input[0 : leftShifts]
- l2 = input[leftShifts :]
- input = l2 + l1
- r1 = input[0 : len(input)-rightShifts]
- r2 = input[len(input)-rightShifts : ]
- return r2 + r1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement