From 30ccfdc677b71f2ec4a79d6240aebacce4d90b0b Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 16 Mar 2015 12:09:14 +0800 Subject: [PATCH] =?UTF-8?q?for-construct=20=E7=BF=BB=E8=AF=91=E6=88=90?= =?UTF-8?q?=E2=80=9Cfor=20=E8=AF=AD=E5=8F=A5=E2=80=9D=EF=BC=8Cfor-loop=20?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E6=88=90=E2=80=9Cfor=20=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eBook/07.1.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eBook/07.1.md b/eBook/07.1.md index c357837..aceb330 100644 --- a/eBook/07.1.md +++ b/eBook/07.1.md @@ -26,7 +26,7 @@ arr1 的长度是 5,索引范围从 0 到 len(arr1)-1 runtime error: index out of range -由于索引的存在,遍历数组的方法自然就是使用 for-construct: +由于索引的存在,遍历数组的方法自然就是使用 for 语句: - 通过 for 初始化数组项 - 通过 for 打印数组元素 @@ -57,7 +57,7 @@ arr1 的长度是 5,索引范围从 0 到 len(arr1)-1 Array at index 3 is 6 Array at index 4 is 8 -for-loop中的条件非常重要:i < len(arr1),如果写成i <= len(arr1)的话会产生越界错误。 +for循环中的条件非常重要:i < len(arr1),如果写成i <= len(arr1)的话会产生越界错误。 IDIOM: @@ -73,7 +73,7 @@ IDIOM: ... } -在这里i也是数组的索引。当然这两种 for-construct 方式对于切片(slices)(参考 [第 7 章](07.2.md))来说也同样适用。 +在这里i也是数组的索引。当然这两种 for 语句对于切片(slices)(参考 [第 7 章](07.2.md))来说也同样适用。 **问题 7.1** 下面代码段的输出是什么?