For example i have a string "mission", i want my program to print as below starting from the first letter.
mission issoinm ssionmi sionmis ionmiss onmissi nmissio
For example i have a string "mission", i want my program to print as below starting from the first letter.
mission issoinm ssionmi sionmis ionmiss onmissi nmissio
This code would give the exact output you're expecting.
def rotate(lst, n):
return lst[-n:] + lst[:-n]
s = 'mission'
for i in range(len(s)):
print(rotate(s,-i), end=' ')
Output:
mission issionm ssionmi sionmis ionmiss onmissi nmissio
The function for rotation was borrowed from this post.