Skip to content · ⁨Passer au contenu⁩

Running total · ⁨Total cumulatif⁩

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.

Français

Total cumulé

Ajoutez la liste [5, 10, 20] un nombre à la fois, en affichant le total après chaque étape : 5, 15, 35.

Les lignes indentées sous for s'exécutent à chaque passage dans la boucle ; une ligne après la boucle ne s'exécute qu'une seule fois. Ici, le print se trouve à l'intérieur de la boucle.

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP