回答編集履歴
1
修正
answer
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
```Python
|
3
3
|
lst = ['29X', 17, 'FREE', '59X', 65]
|
4
4
|
lst = [i for i in lst if isinstance(i, str)] # 文字列のみ
|
5
|
-
cnt = len(lst)
|
5
|
+
cnt = len(lst) # 個数
|
6
6
|
print(cnt)
|
7
7
|
# 3
|
8
8
|
```Xを含む文字列とFREEの個数は、
|
@@ -10,7 +10,7 @@
|
|
10
10
|
lst = ['29X', 17, 'FREE', '59X', 65]
|
11
11
|
lst = [i for i in lst if isinstance(i, str)] # 文字列のみ
|
12
12
|
lst = [i for i in lst if i == 'FREE' or 'X' in i] # FREE or X
|
13
|
-
cnt = len(lst)
|
13
|
+
cnt = len(lst) # 個数
|
14
14
|
print(cnt)
|
15
15
|
# 3
|
16
16
|
```
|