teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

修正

2020/02/03 09:15

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -1,1 +1,23 @@
1
- len(リストオブジェクト) >= n で、n長以上であるか判定できます。
1
+ len(リストオブジェクト) > n で、n+1長以上であるか判定できます。
2
+
3
+ ```Python
4
+ >>> lst = [0, 0, 0]
5
+ >>> lst[2]
6
+ 0
7
+ >>> lst[3]
8
+ Traceback (most recent call last):
9
+ File "<stdin>", line 1, in <module>
10
+ IndexError: list index out of range
11
+ >>>
12
+ >>> len(lst) > 3
13
+ False
14
+ ```
15
+
16
+ ```Python
17
+ >>> lst.append(0)
18
+ >>> lst
19
+ [0, 0, 0, 0]
20
+ >>>
21
+ >>> len(lst) > 3
22
+ True
23
+ ```

1

修正

2020/02/03 09:15

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -1,1 +1,1 @@
1
- `if len(リスト) >= n` で、n長以上であるか判定できます。
1
+ len(リストオブジェクト) >= n で、n長以上であるか判定できます。