dillonseanbarr dillonseanbarr
  • 23-10-2020
  • Computers and Technology
contestada

Does anyone know how to use a while loop and ask a user to input positive integers until the user enters 0 and print the sum so far after each input, then print final sum at the end in edhesive?

Respuesta :

Cytokine
Cytokine Cytokine
  • 23-10-2020

In python:

total = 0

while True:

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

   if num == 0:

       break

   total += num

print(f"The final sum is {total}")

Answer Link

Otras preguntas

How is a plant a renwable resource???
Which of the following techniques is exhibited by these plot summaries
What were most of the problems between the Indians and white settlers the result of Conflicting claims over hunting ares Differences of opinion on land ownersh
marcus gravey beleived that the most important goal of all African Americans must be:
Who is known for creating the language of Cherokee
during the 1840's, many more Americans than British settled in the Oregon country. How do you think that influenced negotiations over the territory?
Unwanted email sent to large groups of people who did not request the communication is called __________. desired funmail returned spam
The two triangles are congruent. What is the measure of angle G? (picture) 79° 35° 101° 66°
For which system of equations is (5, 3) the solution? A. 3x – 2y = 9 3x + 2y = 14 B. x – y = –2 4x – 3y = 11 C. –2x – y = –13 x + 2y = –11 D. 2x – y = 7 2x + 7y
Lowest common multiple of 10 and 23