human
Can you provide a code to calculate the CGPA and CGPA % of marks obtained by a Student in N subjects and the other steps required given the following:
Calculate the CGPA and CGPA % of marks obtained by a Student in N subjects | Python3 program to calculate the CGPA and CGPA percentage of a student.
Variable to store the grades in every subject.
Variables to store CGPA and the sum of all the grades.
Computing the grades.
Computing the sum of grades.
Computing the CGPA.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to calculate the CGPA and CGPA % of marks obtained by a Student in N subjects and the other steps required.
 def CgpaCalc ( marks , n ) :
	grade = [ 0 ] * n
	Sum = 0
	for i in range ( n ) :
	grade [ i ] = ( marks [ i ] / 10 )
	for i in range ( n ) :
	Sum += grade [ i ]
	cgpa = Sum / n
	return cgpa
n = 5
marks = [ 90 , 80 , 70 , 80 , 90 ]
cgpa = CgpaCalc ( marks , n )
print ( " CGPA ▁ = ▁ " , ' % .1f ' % cgpa )
print ( " CGPA ▁ Percentage ▁ = ▁ " , ' % .2f ' % ( cgpa * 9.5 ) )