Construct a python program to read the three subject’s marks secured by n students during an 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.
Sample Workout as given below:
Input:
S1 = {'m1': 50, 'm2': 40, 'm3':75}
S2 = {'m2': 49, 'm3': 35, 'm4':54}
S3 = {'m1': 77, 'm2': 84, 'm4':51}
Output:
{'m1': 0, 'm2': 2, 'm3': 1, 'm4': 0}
2
What I have tried:
n=int(input())
L1=[]
noc=int(input())#no.of.courses
for i in range(1,n+1):
for i in range(1,noc+1):
Course=str(input())
Mark=int(input())
t=(Course,Mark)
L1.append(t)
dict1=dict(L1)
print(dict1)
for Course,Mark in dict1.items():
if Mark<50:
a=[Course]
print(a)