Count the letters · 数字母
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 基础 · Counting loops · 计数循环 →
English
Count the letters
word is "banana". Use a for loop to count its letters into n. Do not use len.
A counter lives outside the loop (so it is not reset every turn) and grows inside it. That shape — set up, loop, use — comes back constantly.
中文
数字母
word 是 "banana"。用 for 循环把字母数量累加进 n。不要用 len。
计数器要放在循环外面(这样才不会每轮都被清零),在循环里面增加。这个形状 —— 准备、循环、使用 —— 之后会不断出现。
word is "banana". Use a for loop to count its letters into n. Do not use len. · word 是 "banana"。用 for 循环把字母数量累加进 n。不要用 len。
Click Run to see the output here. · 点击“运行”查看此处输出。