String rotate

String rotate forward/backwards

Write a function that takes in string argument and n (number) argument and the rotate the given string to nth position

//javascript
rotate("hello",1) => // Expected output: elloh
rotate("hello",2) => // Expected output: llohe
rotate("hello",3) => // Expected output: lohel

rotate("hello",-1) => // Expected output: ohell
rotate("hello",-2) => // Expected output: lohel
rotate("hello",-3) => // Expected output: llohe
//py
def rotate("hello",1)  # Expected output: elloh
def rotate("hello",2)  # Expected output: llohe
def rotate("hello",3)  # Expected output: lohel

def rotate("hello",-1):  # Expected output: ohell
def rotate("hello",-2):  # Expected output: lohel
def rotate("hello",-3):  # Expected output: llohe

RAW CONTENT URL