Running total · 累計合計
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 · Lists (1-D arrays) →
English
Running total
Add up the list [5, 10, 20] one number at a time, printing the total after each step: 5, 15, 35.
Lines indented under the for run every time round the loop; a line after the loop runs only once. Here the print belongs inside the loop.
日本語
累計合計
リスト [5, 10, 20] の各要素を順に加算し、各ステップごとに合計を出力します: 5, 15, 35。
for の下にインデントされた行はループの各反復で実行され、ループの後に置かれた行は一度だけ実行されます。ここでは print はループの内側にあります。
Loop over nums and keep a total. After adding each number, print the total so far: 5, then 15, then 35. · numsをループして合計を維持する。各数値を加えた後に、それまでの合計を出力する:5、次に15、次に35。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。