defining classes class studentdef __init__(selfnamehoursqpoints)self name name self hours float(hoursself qpoints float(qpointsnotice that have used parameter names that match the instance variable names this looks bit strange at firstbut it is very common style for this sort of class have also floated the values of hours and qpoints this makes the constructor bit more versatile by allowing it to accept parameters that may be floatsintsor even strings now that we have constructorit' easy to create student records for examplewe can make record for henry adams like this astudent student("adamshenry" using objects allows us to collect all of the information about an individual in single variable next we must decide what methods student object should have obviouslywe would like to be able to access the student' informationso we should define set of accessor methods def getname(self)return self name def gethours(self)return self hours def getqpoints(self)return self qpoints these methods allow us to get information back out of student record for exampleto print student' name we could writeprint(astudent getname()one method that we have not yet included in our class is way of computing gpa we could compute it separately using the gethours and getqpoints methodsbut gpa is so handy that it probably warrants its own method def gpa(self)return self qpoints/self hours with this class in handwe are ready to attack the problem of finding the best student our algorithm will be similar to the one used for finding the max of numbers we'll look through the file of students one by one keeping track of the best student seen so far here' the algorithm for our program