RossitsaR

Min Max Sum Average

Feb 28th, 2022 (edited)
49
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2.  
  3. min_num = 10000
  4. max_num = -10000
  5. sum_num = 0
  6. avg = 0
  7.  
  8. for i in range (0, n):
  9. num = int(input())
  10. sum_num = sum_num + num
  11. if num >= max_num:
  12. max_num = num
  13.  
  14. if num <= min_num:
  15. min_num = num
  16.  
  17. avg = sum_num / n
  18.  
  19. print(f'min={min_num:.2f}')
  20. print(f'max={max_num:.2f}')
  21. print(f'sum={sum_num:.2f}')
  22. print(f'avg={avg:.2f}')
  23.  
  24.  
RAW Paste Data Copied