human
What is a code to students with maximum average score of three subjects and the other steps required given the following:
Students with maximum average score of three subjects | Function to find the list of students having maximum average score.
Variables to store maximum average score.
List to store names of students having maximum average score.
Traversing the file data.
finding average score of a student.
Clear the list and add name of student having current maximum average score in the list.
Printing the maximum average score and names of students having this maximum average score as per the order in the file ..
Driver Code.
Number of elements in string array"
How can the above be solved in Python?
assistant
#Here is code to students with maximum average score of three subjects and the other steps required.
 def getStudentsList ( file ) :
	maxAvgScore = 0
	names = [ ]
	for i in range ( 0 , len ( file ) , 4 ) :
		avgScore = ( int ( file [ i + 1 ] ) + int ( file [ i + 2 ] ) + int ( file [ i + 3 ] ) ) // 3
		if avgScore > maxAvgScore :
			maxAvgScore = avgScore
			names . clear ( )
			names . append ( file [ i ] )
		elif avgScore == maxAvgScore :
			names . add ( file [ i ] )
	for i in range ( len ( names ) ) :
		print ( names [ i ] , end = " ▁ " )
	print ( maxAvgScore )
if __name__ == " _ _ main _ _ " :
	file = [ " Shrikanth " , "20" , "30" , "10" , " Ram " , "100" , "50" , "10" ]
	getStudentsList ( file )