atanasovetr

Vasi

Nov 30th, 2021
580
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Input some integers to calculate their sum and average. \nInput 0 to exit")
  2. n = int(input())
  3. sum = 0
  4. count = 0
  5. while (n != 0):
  6.     sum += n
  7.     n = int(input())
  8.     count += 1
  9. average = sum / count
  10. print("Average: %.2f" % average)
  11. print("Sum: %.2f" % sum)
  12.  
RAW Paste Data