I am trying to learn how to manipulate strings in python. The algorithm is:
- Input a string such as
Hello World!
. - Left shift the string such that first character of the string is wrapped around to the end of the string with the output as
ello World!H
. Then the code will to the right shift of the same string.
How can I do this? I am aware of the <<
and >>
bitwise shift operators, however these are for int
types only. Would anyone care to point me in the right direction?
I started my code as follows and this is about as far as I can get:
instr = "Hello World!"
length = len(instr) - 1
firstChar = intstr[1]