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