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

explain how the beliefs of the ancient egyptians were reflected in the areas of warfare and burial ceremonies
Solve |3n +6| = 21 Answers: n= -5 and n = 5 n= -9 and n = 9 n= -9 and n = 5 no solution
A polygon which is regular has interior angles measuring 150°. This polygon is called a:​
How does art change people lives
Which of the following groups is common to the majority of amino acids?
have you .......been to the bahamas?
let the dimensions of a rectangle be (4*(871209)^(5)+3*49762105) ft. by (7*(871209)^(3))-(49762105) ft. determine the area of the rectangle
The product of a number and -2 is equal to 20 minus one-third of the number. Find the number​
घ) तिमी आऊ। (उच्च आदर)​
two types of variables