Question: Write the main 7 _ student function, that takes two lists as parameters: the list of Student objects and the list of corresponding topic grades
Write the mainstudent function, that takes two lists as parameters: the list of Student objects and the list of corresponding topic grades for those students. The function should print out the students with their GPA's. GPA values should be rounded to one decimal place.
Example usage:
stud StudentCleo 'Adelaide', 'Adelaide', False
StudentJake 'Clovelly Park', 'Flinders', True
StudentCallum 'Blackwood', 'Flinders', True
StudentDavid 'Blackwood', 'Flinders', False
StudentClaudia 'Blackwood', 'Flinders', True
StudentMona 'Royal Park', 'Adelaide', False
StudentClay 'Clovelly Park', 'Flinders', True
StudentAmy 'Blackwood', 'Flinders', False
StudentWilliam 'Clovelly Park', 'Adelaide', False
StudentLuka 'Royal Park', 'Adelaide', True
gpa PCRCRPHDCR
HDCRDNCRWFHDCRPCRWF
HDCRPFCRHDCRPDNDN
HDDNPCRDNHDCRPCRCR
HDCRPPPWFCRPP
mainstudentstudgpa
output:
Name GPA
Cleo
Jake
Callum
David
Claudia
Mona
Clay
Amy
William
Luka
The definitions for Student and GPA are:
class Student:
An example class to hold basic attributes and methods associated with
a university student object'
def initself name, age, address, uni, sn empl:
self.name name
self.address address
self.age age
self.uni uni
self.sn sn
def calculateGPAself marks:
UNITVALUE
convtable HD:DN:CR:P:F:WF:
numofmarks lenmarks
gpaval
for ind, m in enumeratemarks:
if m in convtable.keys:
gpaval gpaval convtablem UNITVALUE
else:
printError: mark at position d is not acceptable' ind
return gpavalnumofmarksUNITVALUE self.empl empl
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
