I am new to python programming and would like to write a program which has the following requirement:
The program accepts an input string and the number of rotations. Rotate all characters in the string and print the result on screen.
For example, input is ABCDZ 3 Then, output is DEFGC
def rotate(input,d):
Rfirst = input[0 : len(input)-d]
Rsecond = input[len(input)-d : ]
print "Right Rotation : ", (Rsecond + Rfirst)
However, I have written a few codes by myself and turned out that I could only rotate the character within ABCDZ to e.g. ZABCD instead of the rotation pattern dictated in the requirement.
Would anyone like to give help on the issue? How should I start with the correct direction? Thank you very much to all of you. I am really frustrated..