4.2 Code Practice: Question 2
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.
Sample run:
Enter a number: 1
Enter a number: 41
Enter a number: 36
Enter a number: 25
Sum: 103
Numbers Entered: 4
What have you tried so far? Could you share your code?
(Also, what language?)
@Vandesm14
sum = 0
c = 0
while(sum<100):
sum = sum + x
print("sum:"+ str(sum))
print("Numbers entered: " +str(c))
@JenniferMusa Does it work? What problem(s) are you facing?
@Vandesm14 it worked but the only problem is they are asking what x is. sum = sum + x
@JenniferMusa Who's "they"? Can you send me a screenshot of your issue?
@Vandesm14

@JenniferMusa Try running the code on repl.it?
@Vandesm14 yes but gave me the same as this
@JenniferMusa You need to indent the code you want inside the while loop. Python does not use brackets: instead, it uses indentation to figure out which code is in which block.
@Vandesm14 don't worry I finished it already
@JenniferMusa
@Vandesm14 👍