Update kama55.右旋字符串.md

注解更清晰
This commit is contained in:
zhaohanyan
2024-02-22 12:10:18 -05:00
committed by GitHub
parent 2c160f31c5
commit c4ad2ec22e

View File

@ -212,13 +212,12 @@ public class Main {
### Python:
```Python
#注意python中字符串是不可变的所以使用python一定要创建新的字符串
#获取输入的数字k和字符串
k = int(input())
s = input()
#通过切片反转第一段和第二段字符串
#注意python中字符串是不可变的所以也需要额外空间
s = s[len(s)-k:] + s[:len(s)-k]
print(s)
```