The moment the sum first goes over 50
Predict the output · Medium · §7.4 While it is true
This code adds numbers starting from 1 and stops the first time the sum goes over 50. Predict the output without running the code.
Code
total = 0
num = 0
while total <= 50:
num += 1
total += num
print(num, total)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.