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

Can speakers receive and send data?
Create a list of all the different people that could be in a young person’s support network. Next to each person in your list, add on an example of when they mi
There are many ways of generating electrical energy. Research three of the following, describe how they work, and discuss the pros and cons of each of the three
(foods) the transfer of allergens from food containing an allergen to the food served to a customer known as
How do I block someone in brainly/ pls help me someone has been bothering me
Which ratio is equivalent to 3;9?
Write an essay explaining why being overconfident can sometimes result in disappointment.
h(-5)= can anyone please help me with this as fast as possible my test is timed!
A car rental agency charges a weekly rate of $300 for a car and an additional charge of 5 cents for each mile driven. How much miles can you travel in a week fo
help plz rn fast fastvlook at pic!​