[Tutor] Student Class
Ashley Fowler
afowler2 at broncos.uncfsu.edu
Thu Sep 6 00:10:35 CEST 2012
I need help creating a student class. I am suppose to create a student class with there first name, last name, credits
and gpa. Can anybody help me get started? Below is what needs to be included. For number one, is the variables
suppose to be parameters?
for instance,
class Student:
def __init__(self, name, hours, gpa):
self.name = name
1. four instance variables: firstName (a string), lastName (a string),
numCredits (an integer), gpa (a float);
2. an accessor method for each instance variable;
3. a mutator method for each instance variable;
4. an __init__ method that sets all the instance variables to values
provided by the user;
5. a __str__ method that returns a string that contains all the data
of the object in the order: firstName, lastName, numCredits, gpa.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120905/d3302a9d/attachment.html>
More information about the Tutor
mailing list