Kodewick
学びはじめる →
基礎←→0 / 100

ToDo の進み具合

#097基礎約 4 分

ToDo リストでは、終わった仕事は [x]、まだの仕事は [ ] で始まります。"2/5" のような「終わった数/全部の数」の文字列を返す todo_progress(tasks) を書きましょう。空のリストなら "0/0" です。

例
todo_progress(["[x] feed the cat", "[ ] tidy desk", "[x] water plants"])→'2/3'
todo_progress([])→'0/0'
main.py
def todo_progress(tasks):
    done = 0
    for task in tasks:
        # ここにコードを書く:"[x]" で始まる?なら done に 1 たす
        pass
    return f"{done}/{len(tasks)}"
Ctrl + Enter でも実行できます
結果

実行すると例で試せます。よさそうなら提出しましょう。