Answer to Question #221641 in Python for Mikey Meegan

Question #221641

Write a Python program that reads in exam results from the user. The program should then display the number of students who achieved more than 70% in their exam. Assume that the first value read in specifies the number of exam results that are to be entered.


1
Expert's answer
2021-07-29T23:31:49-0400
students = int(input('Enter number of students: '))
marks = []
for i in range (students):
    mark = int(input('Enter mark: '))
    if mark >= 0 and mark <=100:
        marks.append(mark)
    else: 
        print('Invalid marks.')
count = 0
for item in marks:
    if item > 70:
        print(item, end=', ')
        count=count+1
    else:
        pass
print("\n The total number of students who scored more than 70 is ", count)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS