From a2d1fcd59f115ff034ceae3a06079553531d7b01 Mon Sep 17 00:00:00 2001 From: co-zyq <18835594189@163.com> Date: Tue, 25 Aug 2026 11:49:25 +0800 Subject: [PATCH] =?UTF-8?q?Update=2016.=E5=87=BD=E6=95=B0=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=BF=9B=E9=98=B6.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrected the comment in the Python code example to accurately reflect the sorted output. --- ...\225\260\344\275\277\347\224\250\350\277\233\351\230\266.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Day01-20/16.\345\207\275\346\225\260\344\275\277\347\224\250\350\277\233\351\230\266.md" "b/Day01-20/16.\345\207\275\346\225\260\344\275\277\347\224\250\350\277\233\351\230\266.md" index cc8425f2f8..3598962315 100755 --- "a/Day01-20/16.\345\207\275\346\225\260\344\275\277\347\224\250\350\277\233\351\230\266.md" +++ "b/Day01-20/16.\345\207\275\346\225\260\344\275\277\347\224\250\350\277\233\351\230\266.md" @@ -93,7 +93,7 @@ print(new_nums) # [144, 64, 3600, 2704] ```python old_strings = ['in', 'apple', 'zoo', 'waxberry', 'pear'] new_strings = sorted(old_strings) -print(new_strings) # ['apple', 'in', 'pear', waxberry', 'zoo'] +print(new_strings) # ['apple', 'in', 'pear', 'waxberry', 'zoo'] ``` 上面的代码对大家来说并不陌生,但是如果希望根据字符串的长度而不是字母表顺序对列表元素排序,我们可以向`sorted`函数传入一个名为`key`的参数,将`key`参数赋值为获取字符串长度的函数`len`,这个函数我们在之前的课程中讲到过,代码如下所示。