I was trying to make the string HELLO to OHELL in Python. But couldn\'t get any way to rotate it without working with loops. How to code for it in
HELLO
OHELL
Here is what I use to rotate strings in Python3:
To rotate left by n:
def leftShift(text,n): return text[n:] + text[:n]
To rotate right by n:
def rightShift(text,n): return text[-n:] + text[:-n]