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

what is the equation of the line that passes through the point (-6,-5) and had a slope of 3/2
What is the name of a statue which was found during this time period ?
Customers of a phone company can choose between two service plans for long distance calls. The first plan has a $19 monthly fee and charges an additional $0.13
Which of the following best explains how the expansion of feedlots for raising cattle has affected environmental sustainability in rural areas?
How does the artist create a cold feeling in the painting above?
What made the Renaissance a time of both religious reform and scientific advancement? a.the spread of scientific knowledge along the Silk Road and other trade r
If f(x) = 2x2 + 1, what is f(x) when x = 3?.
Developing an Idea through Comparison how does putting your money in a bank compare putting your money in stocks,bonds and securities
plzzzzzz helppp out with thiss​
I will mark brainlist if you can solve the cipher code