day08 代码随想录算法训练营 卡码网:55.右旋转字符串

题目:卡码网:55.右旋转字符串 

我的感悟:

  • python中的切片很厉害。
  • 我感觉go好像也是切片的

理解难点:

  • 没理解为什么是-n
  • 我这样写是移动前面的,
  • 题目要求移动后面的。感谢群里的人帮助我
  •  

代码难点:

总结概括:

代码示例:

n = int(input())
s = input()

res =  s[-n:] +s[:-n]   # 取后面+取前面
print(res)

通过截图:

资料:

https://programmercarl.com/kama55.%E5%8F%B3%E6%97%8B%E5%AD%97%E7%AC%A6%E4%B8%B2.html#%E6%80%9D%E8%B7%AF

posted @ 2024-01-04 18:23  o蹲蹲o  阅读(2)  评论(0编辑  收藏  举报