rotate string in python
def rotate_string(s,d):
# slice string in two parts for left and right
Lfirst = s[0 : d]
Lsecond = s[d :]
Rfirst = s[0 : len(s)-d]
Rsecond = s[len(s)-d : ]
# now join two parts together
print ("Left Rotation : ", (Lsecond + Lfirst) )
print ("Right Rotation : ", (Rsecond + Rfirst))
string = 'Studytonight'
d=4
rotate_string(string,d)