# cs1110.py # Anne Bracy (awb93) # March 26, 2018 """Module with a simple student class. Class demonstrates attributes (class and instance) and a constructor.""" class Student(): """Instance is a student taking python Class variables: enrollment: number of python_student instances [int] Instance variables: name: student's full name [str] NetID: student's NetID [str], 2-3 letters + 1-4 numbers is_auditing: whether student is auditing the class [bool] """ enrollment = 0 def __init__(self, name, NetID, is_auditing): """Initializer: instance with name, NetID, and auditing status. name: student's full name [str] NetID: student's NetID [str], 2-3 letters + 1-4 numbers is_auditing: whether student is auditing the class [bool] """ assert type(name) == str, "name should be type str" assert type(NetID) == str, "NetID should be type str" #skipping char+num check assert type(is_auditing) == bool, "is_auditing should be type bool" self.name = name self.NetID = NetID self.is_auditing = is_auditing Student.enrollment = self.enrollment + 1 def greet(self): print("Hi! My name is "+self.name+" ("+self.NetID+")") if self.is_auditing: print("I'm auditing the class")