Ai
1 Star 0 Fork 0

Role/Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
string_rotation.py 536 Bytes
一键复制 编辑 原始数据 按行查看 历史
Yash 提交于 2020-10-01 11:50 +08:00 . Update string_rotation.py
#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']
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/CRole/Python.git
git@gitee.com:CRole/Python.git
CRole
Python
Python
master

搜索帮助