Count the positives
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
This one builds on a lesson you haven't finished yet. Do that lesson first: · これはまだ完了していないレッスンの先にある内容です。まずはそのレッスンを済ませてください:
Python Basics · Functions →
English
Count the positives
Return how many numbers in a list are greater than 0. Zero itself does not count.
A counter starts at 0 and grows by 1 each time the condition is true.
日本語
正の数のカウント
リスト内で 0 より大きい数がいくつあるかを返します。ゼロ自体はカウントしません。
カウンタは 0 で始め、条件が真になるたびに 1 ずつ増えます。
Write count_positive(nums) that returns how many numbers in the list are greater than 0.
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。