diff --git a/problems/kama55.右旋字符串.md b/problems/kama55.右旋字符串.md index 17c97eaa..38e37322 100644 --- a/problems/kama55.右旋字符串.md +++ b/problems/kama55.右旋字符串.md @@ -211,7 +211,17 @@ public class Main { ``` ### Python: +```Python +#注意:python中字符串是不可变的,所以使用python一定要创建新的字符串 +#获取输入的数字k和字符串 +k = int(input()) +s = input() + +#通过切片反转第一段和第二段字符串 +s = s[len(s)-k:] + s[:len(s)-k] +print(s) +``` ### Go: ```go