49.3k views
4 votes
Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the count of how many numbers were entered.

User Yantrab
by
4.9k points

1 Answer

4 votes

total = 0

count = 0

while total < 100:

num = int(input("Enter a number: "))

total += num

count += 1

print("Sum: {}".format(total))

print("Numbers Entered: {}".format(count))

I'm pretty sure this is what you're looking for. Best of luck!

User Ajithmanmu
by
5.9k points