python 3.x - How to rotate and print all the characters of a string in python3 starting from every character of the string? -


for example have string "mission", want program print below starting first letter.

mission issoinm ssionmi sionmis ionmiss onmissi nmissio

this code give exact output you're expecting.

def rotate(lst, n):     return lst[-n:] + lst[:-n]  s = 'mission'  in range(len(s)):     print(rotate(s,-i), end=' ') 

output:

mission issionm ssionmi sionmis ionmiss onmissi nmissio 

the function rotation borrowed this post.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -