Answer to Question #263448 in Python for Peaches

Question #263448

Program to calculate the average of all score entered between 0 to 100. Use sentinel- controlled loop variable


1
Expert's answer
2021-11-09T10:21:51-0500
print("Input some integers to calculate their sum and average. Input 0 to exit.")


count = 0
sum = 0.0
number = 1


while number != 0:
  number = int(input(""))
  sum = sum + number
  count += 1


if count == 0:
  print("Input some numbers")
else:
  print("Average and Sum of the above numbers are: ", sum / (count-1), sum)1

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS