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 & AP