Skip to content

Count the letters

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.

Log in or create account

IGCSE, A-Level & AP