Answer to Question #284046 in Python for hii

Question #284046

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.


1
Expert's answer
2022-01-02T02:23:41-0500



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')

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