Advertisement
makispaiktis

Vathmoi2

Feb 18th, 2021 (edited)
837
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. degrees = list()
  2. print()
  3. for degree in range(0, 11):
  4.     numOfStudents = int(input("How many students wrote " + str(degree) + "? "))
  5.     for j in range(numOfStudents):
  6.         degrees.append(degree)
  7.     if degree >= 5 and degree < 10:
  8.         numOfStudents2 = int(input("How many students wrote " + str(degree + 0.5) + "? "))
  9.         for j in range(numOfStudents2):
  10.             degrees.append(degree + 0.5)
  11.  
  12. N = len(degrees)
  13. SUM = 0
  14. for i in range(N):
  15.     SUM += degrees[i]
  16. average = SUM / N
  17.  
  18. N2 = 0
  19. SUM2 = 0
  20. for i in range(N):
  21.     if degrees[i] >= 5:
  22.         N2 += 1
  23.         SUM2 += degrees[i]
  24. average2 = SUM2 / N2
  25.  
  26. print()
  27. print("Students: " + str(N))
  28. passedPercentage = N2 / N
  29. passedPercentage = round(100 * passedPercentage, 2) / 100
  30. print("Passed: " + str(N2) + " / " + str(N) + " <----> " + str(100 * passedPercentage) + "%")
  31. print("Average = " + str(average))
  32. print("Average of the students that passed: " + str(average2))
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement