-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcourse.py
40 lines (31 loc) · 1.15 KB
/
course.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''
Course object that keeps tracks of course information, students enrolled and whether it's mandatory.
Used when sampling roster data with sample.py
'''
class Course(object):
def __init__(self, course_name, teacherid, subject, mandatory = False):
'''
Constructor accepts information about the course as well as whether it
cannot be involved in the sampling process (mandatory)
'''
#variable assignments
self.student_list = []
self.students_removed = 0
self.course_name = course_name
self.teacher_id = teacherid
self.subject = subject
self.mandatory = mandatory
self.closed = False
def add(self,studentid):
self.student_list.append(studentid)
def get_percentage(self):
return float(len(self.student_list) - self.students_removed)/len(self.student_list)
def get_whatif_percentage(self):
return float(len(self.student_list) - (self.students_removed+1))/len(self.student_list)
def reset(self):
'''
Reset course to resample
:return:
'''
self.students_chosen = []
self.closed = False