Skip to content · ⁨דלג לתוכן⁩

Running total · ⁨סכום רץ⁩

English

Running total

Add up the list [5, 10, 20] one number at a time, printing the total after each step: 5, 15, 35.

Lines indented under the for run every time round the loop; a line after the loop runs only once. Here the print belongs inside the loop.

עברית

סכום מצטבר

חשב את הסכום של הרשימה [5, 10, 20] מספר אחד באחד, והדפס את הסכום הכולל לאחר כל צעד: 5, 15, 35.

שורות מוזזות לתוך ה-for רצים בכל פעם שהלולאה מתחודשת; שורה אחרי הלולאה רצה רק פעם אחת. כאן ה-print נמצא בתוך הלולאה.

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP