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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -