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