Draw a flowchart and construct a python program to read the three subject’s marks secured by n students during FAT examination. If a student secured less than 50 in any subject, the student is failed in that subject. Count the number of students who failed in each subject and the total number of students who failed in at least one subject.
fail_1 = 0
fail_2 = 0
fail_3 = 0
fail_any = 0
for i in range(50):
fail = False
print('Enter the first mark for student', i+1, end =': ')
mark1 = int(input())
if mark1 < 50:
fail_1 += 1
fail = True
print('Enter the second mark for student', i+1, end =': ')
mark2 = int(input())
if mark2 < 50:
fail_2 += 1
fail = True
print('Enter the third mark for student', i+1, end =': ')
mark3 = int(input())
if mark3 < 50:
fail_3 += 1
fail = True
if fail:
fail_any += 1
print('Fail in first subject', fail_1)
print('Fail in second subject', fail_2)
print('Fail in third subject', fail_3)
print(fail_any, ' students failed at least one subject')
Comments
Leave a comment