Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started