Beginner
Add numbers until a zero appears
The list data ends its real numbers at the first 0. Use a while loop to add up the numbers before the first 0 into the variable total.
Print the line Total: followed by the total. The list always contains a 0.
What Check tests
[5, 10, 0, 7]gives a total of 15[3, 4, 0, 9]gives 7[0, 5]gives 0- Your code uses a
whileloop - The program prints
Total: 15
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.