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.
ספור את האותיות
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. · לחץ על הרץ כדי לראות את התוצא כאן.