# 初期化
lst = []
for i in range(5):
# 追加
lst.append(i)
print(lst) # [0, 1, 2, 3, 4]
# フィルターをかける
filtered = list(filter(lambda x:x == 1, lst))
print(filtered) # [1]
# カウントする
print(len(filtered)) # 1
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme