/
rnekrasov
/
Python
Обзор
Документация
Войти
/
rnekrasov
/
Python
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
string_rotation.py
27 строк
549 B
slowy07
refactor: clean code
30 янв 2022, 04:33
30 янв 2022, 04:33
f0af0c4
Код
Авторство
О чём код?
# This program rotates a given string letters by letters # for example: # input: "Tie" # Output: ["ieT", "eTi"] def rotate(n): a = list(n) if len(a) == 0: return print([]) l = [] for i in range(1, len(a) + 1): a = [a[(i + 1) % (len(a))] for i in range(0, len(a))] l += ["".join(a)] print(l) string = str(input()) print("Your input is :", string) print("The rotation is :") rotate(string) # Input : Python # output : # The rotation is : # ['ythonp', 'thonpy', 'honpyt', 'onpyth', 'npytho', 'python']