0

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

John Kugelman
  • 330,190
  • 66
  • 504
  • 555
Nani
  • 41
  • 3

1 Answers1

0

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.

Ébe Isaac
  • 9,909
  • 16
  • 56
  • 91