果樹園でりんごの重さをはかります。200 グラム以上なら大きいりんごです。is_big と count_big は書いてあります。count_if(items, check) を完成させましょう。check は関数なので、各要素に対して呼び出し、True になった数を数えます。空のリストなら 0 です。
count_big([180, 210, 200, 150])→2count_big([])→0def is_big(weight):
return weight >= 200
def count_if(items, check):
n = 0
for x in items:
# ここにコードを書く:check(x) が True なら n に 1 を足す
pass
return n
def count_big(weights):
return count_if(weights, is_big)
実行すると例で試せます。よさそうなら提出しましょう。