Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.09 KB | None | 0 0
  1. ##########
  2. class Students:
  3.  
  4. def __init__(self, students=[]):
  5. self.students = dict()
  6. for student in self.students:
  7. self.students[student.fetch_number()] = student
  8.  
  9. def add_student(self, student):
  10. ''' Add a student to the students dictionary.
  11. Return True if successful, else return False. '''
  12. # YOUR CODE HERE
  13. pass
  14.  
  15. def add_students(self, students):
  16. ''' Add list of students to the students dictionary. '''
  17. # YOUR CODE HERE
  18. pass
  19.  
  20. def fetch_students(self):
  21. ''' Return the students dictionary. '''
  22. return self.students
  23.  
  24. def fetch_student(self, studentID):
  25. ''' Return the student with this student number (ID). '''
  26. # YOUR CODE HERE
  27. pass
  28.  
  29. def fetch_student_numbers(self):
  30. return list(self.students.keys())
  31.  
  32.  
  33.  
  34. class Student:
  35.  
  36. def __init__(self, first_name = 'First_Name',
  37. last_name = 'Last_Name',
  38. student_number = '0000'):
  39. self.first_name = first_name
  40. self.last_name = last_name
  41. self.student_number = student_number
  42. self.past_courses = [] # course numbers (IDs)
  43. self.current_courses = [] # course numbers (IDs)
  44.  
  45. def fetch_name(self):
  46. ''' Return the name of this student, (first_name, last_name). '''
  47. # YOUR CODE HERE
  48. pass
  49.  
  50. def fetch_number(self):
  51. ''' Return this students student number (ID). '''
  52. # YOUR CODE HERE
  53.  
  54. def add_past_courses(self, course_IDs = []):
  55. ''' Append this list of past course numbers (IDs)
  56. to the list of this student's past courses. '''
  57. # YOUR CODE HERE
  58. pass
  59.  
  60. def add_current_courses(self, course_IDs = []):
  61. ''' Append this list of current course numbers (IDs)
  62. to the list of this student's current courses. '''
  63. # YOUR CODE HERE
  64. pass
  65.  
  66. def add_course(self, courseID):
  67. ''' Append this course number (ID) to the list of current_courses. '''
  68. # YOUR CODE HERE
  69. pass
  70.  
  71. def fetch_past_courses(self): return self.past_courses
  72.  
  73. def fetch_current_courses(self): return self.current_courses
  74.  
  75. def drop_current_course(self, courseID):
  76. ''' Drop this course number (ID) from the list of current_courses.
  77. Return True if successful, else return False. '''
  78. #YOUR CODE HERE
  79. pass
  80.  
  81. def drop_all_current_courses(self):
  82. ''' Empty the current_courses list. '''
  83. self.current_courses = []
  84.  
  85. def current_to_past_courses(self):
  86. ''' Move all current course numbers (IDs) to the list of past_courses. '''
  87. self.past_courses += self.current_courses
  88. self.drop_all_current_courses()
  89.  
  90.  
  91.  
  92. class Courses:
  93.  
  94. def __init__(self, courses=[]):
  95. self.courses = dict()
  96. # This dictionary has course numbers (IDs) for its keys.
  97. for course in courses:
  98. self.courses[course.fetch_course_number()] = course
  99.  
  100. def add_course(self, course):
  101. ''' Add this course to the courses dictionary.
  102. Return True if successful, else return False. '''
  103. # YOUR CODE HERE
  104. pass
  105.  
  106. def add_courses(self, courses):
  107. # YOUR CODE HERE
  108. pass
  109.  
  110. def fetch_course_numbers(self):
  111. ''' Return a list of course numbers (IDs). '''
  112. return list(self.courses.keys())
  113.  
  114. def fetch_courses(self):
  115. ''' Return the dictionary of courses. '''
  116. return self.courses
  117.  
  118. def fetch_course(self, courseID):
  119. ''' Fetch the course with this course number (ID). '''
  120. #YOUR CODE HERE
  121. pass
  122.  
  123.  
  124. class Course:
  125.  
  126. def __init__(self, course_name = 'CS 000',
  127. course_number = '0000',
  128. semester = 'Fall',
  129. year = 2019,
  130. enrolled_students = []):
  131. ''' The enrolled_students argument is a list of student numbers (Ids) '''
  132.  
  133. self.course_name = course_name
  134. self.course_number = course_number
  135. self.semester = semester
  136. self.year = year
  137. # This dictionary has student numbers (IDs) as keys,
  138. # and the student's grade as the value.
  139. self.enrolled_students = {student : 'NG' for student in enrolled_students}
  140.  
  141. def fetch_course_name(self):
  142. ''' Return this course name. '''
  143. # YOUR CODE HERE
  144. pass
  145.  
  146. def fetch_course_number(self):
  147. ''' Return this course number. '''
  148. # YOUR CODE HERE
  149. pass
  150.  
  151. def fetch_enrolled_studentIDs(self):
  152. ''' Return a list of enrolled student numbers (IDs). '''
  153. return list(self.enrolled_students.keys())
  154.  
  155. def fetch_enrolled_students(self):
  156. ''' Return the dictionary of enrolled students and their grades. '''
  157. # YOUR CODE HERE
  158. pass
  159.  
  160. def fetch_when_offered(self):
  161. ''' Return (semester, year) of when this course was offered. '''
  162. return (self.semester, self.year)
  163.  
  164. def enroll_student(self, studentID):
  165. ''' Enroll a student in the course.
  166. Return True if successful, else return False. '''
  167. # YOUR CODE HERE
  168. pass
  169.  
  170. def enroll_students(self, studentIDs):
  171. ''' Enroll multiple students in the course.
  172. Return True if successful, else return False. '''
  173. # YOUR CODE HERE
  174. pass
  175.  
  176. def drop_student(self, studentID):
  177. ''' Drop this student from the course.
  178. Return True if successful, else return False. '''
  179. # YOUR CODE HERE
  180. pass
  181.  
  182. def submit_grade(self, studentID, grade):
  183. ''' Enter a grade for this student. '''
  184. # YOUR CODE HERE
  185. pass
  186.  
  187. def fetch_grades(self):
  188. ''' Return the enrolled_students dictionary. '''
  189. return self.enrolled_students
  190.  
  191. def fetch_grade(self, studentID):
  192. ''' Return this student’s grade. '''
  193. # YOUR CODE HERE
  194. pass
  195.  
  196.  
  197.  
  198. def roll_courses():
  199. ''' A semester has finished, and the grades are all in. This function rolls all
  200. the current courses for each student from current_courses to past_courses. '''
  201. pass
  202. def compute_gpa(studentID):
  203. ''' Returns the GPA of the student with input student number(ID),
  204. rounded off to 2 decimal places. '''
  205. pass
  206. def compute_gpas(studentIDs):
  207. ''' Retuns a list of the gpas of all the students on the input list. '''
  208. pass
  209. def best_student():
  210. ''' Returns the name of the student with the highest GPA, in the format:
  211. FirstName LastName (with one space between them) '''
  212. pass
  213. def worst_student():
  214. ''' Returns the name of the student with the lowest GPA, in the format:
  215. FirstName LastName (with one space between them) '''
  216. pass
  217. def compute_mean_GPA():

  218. ''' Return the mean GPA of all students, rounded off to 2 decimal places. '''
  219. pass
  220.  
  221. def compute_mean_course_GPA(courseID):
  222. ''' Returns the mean GPA for the grades assigned to students who took this course. '''
  223. pass
  224.  
  225. all_courses = Courses()
  226. all_students = Students()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement