From c4ad2ec22e01bc0cdfde6dbbea91748e20bbdf16 Mon Sep 17 00:00:00 2001 From: zhaohanyan Date: Thu, 22 Feb 2024 12:10:18 -0500 Subject: [PATCH] =?UTF-8?q?Update=20kama55.=E5=8F=B3=E6=97=8B=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 注解更清晰 --- problems/kama55.右旋字符串.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/problems/kama55.右旋字符串.md b/problems/kama55.右旋字符串.md index 38e37322..71371860 100644 --- a/problems/kama55.右旋字符串.md +++ b/problems/kama55.右旋字符串.md @@ -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) ```