Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

n=int(input("Enter Number of Students :"))

marks=[]

present,sum,min,max=0,0,51,-1
absent=0

for i in range(n):

temp=input("Enter the marks for the student "+str(i+1)+" or AB if absent : ")


if(temp=="AB" or int(temp)>=0 or int(temp)<51):
marks.append(temp)
if temp!="AB":
present+=1
sum+=int(temp)

if int(temp)>max:
max=int(temp)
if int(temp)<min:
min=int(temp)
else :
absent+=1
else:
print("Invalid Input Try Again Enter Marks in Range(0-50)")
break

avg=sum/present

max_Freq=0
freq_arr=[]

for i in range(0,51):
freq=0
for j in marks:
if j!="AB" and i==int(j):
freq+=1
if freq>max_Freq:
max_Freq=freq
freq_arr.clear()
freq_arr.append(i)

elif freq==max_Freq:
freq_arr.append(i)

print("The average score of the class : ",avg)


print("Highest score : ",max," Lowest Score : ",min)
print("Number of Students who were Absent :",absent)

print("Display Marks with Highest Frequency ",max_Freq," is : ",freq_arr)

You might also like