Advertisement
makispaiktis

Vathmoi

Jan 18th, 2021 (edited)
1,333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. degrees = list()
  2. for i in range(0, 11):
  3.     d = int(input("Number of students that wrote " + str(i) + ": "))
  4.     degrees.append(d)
  5. N = 0
  6. for i in range(len(degrees)):
  7.     N += degrees[i]
  8. sum = 0
  9. for i in range(len(degrees)):
  10.     sum += i * degrees[i]
  11. average = sum / N
  12. sum2 = 0
  13. N2 = 0
  14. for i in range(5, len(degrees)):
  15.     N2 += degrees[i]
  16. for i in range(5, len(degrees)):
  17.     sum2 += i * degrees[i]
  18. average2 = sum2 / N2
  19. print()
  20. print("Students: " + str(N))
  21. passed = N2 /N
  22. passed = round(100 * passed, 2) / 100
  23. print("Passed: " + str(100 * passed) + "%")
  24. print("Average = " + str(average))
  25. print("Average of the students that passed: " + str(average2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement