Skip to content

Count the letters · ⁨数字母⁩

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。

计数器要放在循环外面(这样才不会每轮都被清零),在循环里面增加。这个形状 —— 准备、循环、使用 —— 之后会不断出现。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩