boomer81 boomer81
  • 24-11-2020
  • Computers and Technology
contestada

What am I doing wrong?

What am I doing wrong class=

Respuesta :

Cytokine
Cytokine Cytokine
  • 24-11-2020

In your example, you're asking the user for a number and then you're setting total and nums equal to zero. This results in your first number being ignored by the program. I included the complete working code below:

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

total = num

nums = 1

while (total <= 100):

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

   nums = nums + 1

   total = total + num

print("Sum: "+str(total))

print("Numbers Entered: "+str(nums))

I hope this helps!

Answer Link

Otras preguntas

how many defensive positions are there in baseball
Can you help me solve this ?
Ill give godliest if you answer, and please show your work
Does anyone have the answer key for this assignment?
Place the following events in chronological order earlier to most recent
Which of the requirements were "good news" for settlers in the Mexican Colonization Law of 1825?
13 + 2(3x − 7) please help
3. Describe and correct the error
In a random sample of 175 community college students, the mean number of hours spent studying per week is 13.7 hours and the standard deviation is 4 hours. Assu
How do I delete my account for brainly, and don't say preferences because, every time I try to delete it, it doesn't get deleted, and brainly LET ME MAKE A NEW