Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- degrees = list()
- print()
- for degree in range(0, 11):
- numOfStudents = int(input("How many students wrote " + str(degree) + "? "))
- for j in range(numOfStudents):
- degrees.append(degree)
- if degree >= 5 and degree < 10:
- numOfStudents2 = int(input("How many students wrote " + str(degree + 0.5) + "? "))
- for j in range(numOfStudents2):
- degrees.append(degree + 0.5)
- N = len(degrees)
- SUM = 0
- for i in range(N):
- SUM += degrees[i]
- average = SUM / N
- N2 = 0
- SUM2 = 0
- for i in range(N):
- if degrees[i] >= 5:
- N2 += 1
- SUM2 += degrees[i]
- average2 = SUM2 / N2
- print()
- print("Students: " + str(N))
- passedPercentage = N2 / N
- passedPercentage = round(100 * passedPercentage, 2) / 100
- print("Passed: " + str(N2) + " / " + str(N) + " <----> " + str(100 * passedPercentage) + "%")
- print("Average = " + str(average))
- print("Average of the students that passed: " + str(average2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement