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

Read the excerpt from "The Most Dangerous Game." Laughter shook the general. "How extraordinarily droll you are!" he said. "One does not expect nowadays to fin
A company provides literary copyrights to another company for its use. which type of collaborative arrangement does this situation​ illustrate? a. equity allian
what is 6P4 permutations and combinations
Disagreements between the United States and the Soviet Union about postwar Europe helped start the Cold War. Match each statement about the postwar world to the
The graph depends the velocity and times of Elan and Anna during a race
Please help, take it serious, thanks! (03.05) Escribe la palabra correcta que completa la frase. Write the word that completes the sentence. You may copy and pa
Help ASAP !!! This is timed!!!!
"when road surfaces and traffic are normal, what does new jersey law prohibit?"
How is the Declaration of Sentiments historically important to our country's foundation? A. It was the first abolitionist document. B.It addressed both the rig
Mike's Bikes has mountain bikes that usually sell for $275 on sale for $220. Mike used this ratio to find the percent change. Is he correct? Explain. 55/220 = 2