PYTHON   26

avenum

Guest on 23rd August 2022 11:01:47 AM

  1. total = 0
  2. count = 0
  3. while (True):
  4.     inp = input('Enter a number: ')
  5.     if inp == 'done': break
  6.     value = float(inp)
  7.     total = total + value
  8.     count = count + 1
  9.  
  10. average = total / count
  11. print('Average:', average)

Raw Paste


Login or Register to edit or fork this paste. It's free.