Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Classroom:
- def __init__(self, subject, teacher, nstudents, nta = 0, maxstudents = 30):
- self.subject = subject
- self.teacher = teacher
- self.nstudents = nstudents
- self.nta = nta
- self.maxstudents = maxstudents
- def getsubject(self):
- return self.subject
- def getteacher(self):
- return self.teacher
- def getnstudents(self):
- return self.nstudents
- def getnta(self):
- return self.nta
- def getmaxstudents(self):
- return self.maxstudents
- def setmaxstudents(self, maxval):
- self.maxstudents=maxval
- def setta(self, ta):
- self.nta = ta
- def addstudent(self, num):
- 'increments the number of students in the class by num up to the max'
- for waiting in range(num):
- self.nstudents = self.nstudents + 1
- if self.nstudents == self.maxstudents:
- break
- def dropstudent(self, num):
- 'decrements the number of students in the class by num down to 0'
- for waiting in range(num):
- self.nstudents = self.nstudents -1
- if self.nstudents == 0:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement