Teo_Yanchev

Histogram

Jun 28th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. n =int(input())
  2.  
  3. p1 = 0
  4. p2 = 0
  5. p3 = 0
  6. p4 = 0
  7. p5 = 0
  8.  
  9. for i in range(1, n+1):
  10. number = int(input())
  11. if number < 200:
  12. p1 += 1
  13. elif 200 <= number <= 399:
  14. p2 += 1
  15. elif 400 <= number <= 599:
  16. p3 += 1
  17. elif 600 <= number <= 799:
  18. p4 += 1
  19. else:
  20. p5 += 1
  21. print(f"{p1 / n * 100:.2f}%")
  22. print(f"{p2 / n * 100:.2f}%")
  23. print(f"{p3 / n * 100:.2f}%")
  24. print(f"{p4 / n * 100:.2f}%")
  25. print(f"{p5 / n * 100:.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment