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.
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)
Comments
Leave a comment