You are on page 1of 3

Untitled20 http://localhost:8888/nbconvert/html/Untitled20.ipyn...

In [1]: def removeabsenty(list1):


lst=[]
for i in list1:
if i!='ab':
lst.append(i)
return lst

def avg(list1):
total=0
for i in list1:
total=total+int(i)
return (total/len(list1))

def highest(list1):
max=int(list1[0])
for i in list1:
if int(i)>max:
max=int(i)
return max

def lowest(list1):
min=int(list1[0])
for i in list1:
if int(i)<min:
min=int(i)
return min

def countabsenty(list1):
count=0
for i in list1:
if i=='ab':
count=count+1
return count

def highestfreq(list1):
highest_frequency={}
max=0
for i in list1:
highest_frequency[i]=highest_frequency.get(i,0)+1
if highest_frequency[i]>max:
max=highest_frequency[i]
result=[]
for i,j in highest_frequency.items():
if j ==max:
result.append(i)
return result
#Main function
Secomp=[]
n=int(input("Enter a number of students in class:\n"))
print("Enter a score in subject Fundamental of Data Structres of all students in Se
for i in range(0,n):
a=input()
Secomp.append(a)
flag=1
while flag==1:
print("Menu:\n1.The average score of class.\n2.Highest score and lowest score o
ch=int(input("Enter a choice:\n"))
if ch==1:
print("The average score of class is :",avg(removeabsenty(Secomp)))
print("Do you want to continue :Yes/No")
c=input()

1 of 3 11/09/23, 11:16
Untitled20 http://localhost:8888/nbconvert/html/Untitled20.ipyn...

c=input()
if(c=='Yes'):
flag=1
else:
flag=0
print("Thank you for using program")
if ch==2:
print("Highest score of a student in class Secomp is :",highest(removeabsen
print("Lowest score of a student in class Secomp is :",lowest(removeabsenty
print("Do you want to continue :Yes/No")
c=input()
if(c=='Yes'):
flag=1
else:
flag=0
print("Thank you for using program")
if ch==3:
print("Count of students who were absent for the test in class Secomp is :"
print("Do you want to continue :Yes/No")
c=input()
if(c=='Yes'):
flag=1
else:
flag=0
print("Thank you for using program")
if ch==4:
print("Marks with highest frequency in class Secomp is :",highestfreq
print("Do you want to continue :Yes/No")
c=input()
if(c=='Yes'):
flag=1
else:
flag=0
print("Thank you for using program")

Enter a number of students in class:


21
Enter a score in subject Fundamental of Data Structres of all students in
Secomp:
10
27
ab
94
20
ab
67
20
10
94
20
89
0
90
ab
57
28
20
ab
90
57

2 of 3 11/09/23, 11:16
Untitled20 http://localhost:8888/nbconvert/html/Untitled20.ipyn...

Menu:
1.The average score of class.
2.Highest score and lowest score of class.
3.Count of students who were absent for the test.
4.Display mark with highest frequency.
Enter a choice:
1
The average score of class is : 46.64705882352941
Do you want to continue :Yes/No
Yes
Menu:
1.The average score of class.
2.Highest score and lowest score of class.
3.Count of students who were absent for the test.
4.Display mark with highest frequency.
Enter a choice:
2
Highest score of a student in class Secomp is : 94
Lowest score of a student in class Secomp is : 0
Do you want to continue :Yes/No
Yes
Menu:
1.The average score of class.
2.Highest score and lowest score of class.
3.Count of students who were absent for the test.
4.Display mark with highest frequency.
Enter a choice:
3
Count of students who were absent for the test in class Secomp is : 4
Do you want to continue :Yes/No
Yes
Menu:
1.The average score of class.
2.Highest score and lowest score of class.
3.Count of students who were absent for the test.
4.Display mark with highest frequency.
Enter a choice:
4
Marks with highest frequency in class Secomp is : ['20']
Do you want to continue :Yes/No
No
Thank you for using program

In [ ]:

In [ ]:

3 of 3 11/09/23, 11:16

You might also like