Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. n_count = int(input())
  2. p1 = 0
  3. p2 = 0
  4. p3 = 0
  5. p4 = 0
  6. p5 = 0
  7. countp1 =0
  8. countp2 =0
  9. countp3 =0
  10. countp4 =0
  11. countp5 =0
  12.  
  13. for x in range(1, n_count+1):
  14. current_num = int(input())
  15.  
  16. if current_num < 200:
  17. countp1 += 1
  18. p1 = (countp1 / n_count) * 100
  19.  
  20. elif 200<= current_num <400:
  21. countp2 += 1
  22. p2 = (countp2 / n_count) * 100
  23. elif 400 <= current_num < 600:
  24. countp3 += 1
  25. p3 = (countp3 / n_count) * 100
  26. elif 600 <= current_num < 800:
  27. countp4 += 1
  28. p4 = (countp4 / n_count) * 100
  29. elif current_num >= 800:
  30. countp5 += 1
  31. p5 = (countp5/ n_count) * 100
  32. print(f'{p1:.2f}%')
  33. print(f'{p2:.2f}%')
  34. print(f'{p3:.2f}%')
  35. print(f'{p4:.2f}%')
  36. print(f'{p5:.2f}%')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement