Add up to five · 加到五
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 · Python 基础 · While loops · while 循环 →
English
Add up to five
Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15.
Two things change every time round: the running total, and the counter n. Miss the counter and the loop never ends; miss the total and it ends with nothing in it.
中文
加到五
用 while 循环把 1 + 2 + 3 + 4 + 5 累加进 total。total 最后应该是 15。
每一轮有两样东西在变:累加的 total 和计数器 n。少了计数器,循环停不下来;少了累加,循环结束时里面什么也没有。
Use a while loop to add 1 + 2 + 3 + 4 + 5 into · 生成 total. total should end as 15. · 用 while 循环把 1 + 2 + 3 + 4 + 5 累加进 total。total 最后应该是 15。
Click Run to see the output here. · 点击“运行”查看此处输出。