Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

a new Course, with no students enroled Course(subjeet, number, seetion, cap, days, start_tin1e, dur) add_student a new student number is added (self,...

Can u help give me some advice about this question? i have finished my code , but there is something wrong, can u point it out?

The function should use that file to return a two-element list. The rest element in the list will be a

Course that has been created and updated with the information from the le. The second

element of the returned list contains a list of student numbers representing students on a

wait list for the course.

The rst line of the le contains the subject, course number, section number, cap size,

days of the week, start time hour, start time minutes, and duration for the course. The

rest of the lines of the le include students numbers for those who want to enrol in the

course. There may be duplicate numbers included these line of the le. The students

should be added to the course in the order that their numbers appear in the le until the

cap size is met. Duplicate numbers should be ignored. Any additional numbers from the

le that could not be added to the class list should be included in the waiting list that

start course returns. The waiting list should have the numbers appear in the same order

as they did in the text file. There may be duplicates in this list.

here is the Course.py interface:

here is my code:

from Course import *

def start_course(filename):

  '''

  returns a two-element list: the first one is updated Course information; 

  the second one is the student waiting list for this Course,

  given the filename of a text file with Course information

  start_course: Str -> List

  '''

  data = open(filename)

  firstline = data.readline()

  info = firstline.split()

  __init__(CourseInfo, info[0], info[1], info[2], info[3], info[4], info[5], info[6])

  others = data.readlines()

  students = others.remove(firstline)

  unique_list = []

  for x in students:

    if x not in unique_list:

      unique_list.append(x)

  enroled_students = unique_list[0: CourseInfo._cap]

  CourseInfo._id_list = enroled_students

  beginning = students.index(enroled_students[-1])

  waiting_list = students[beginning:]

  result = [CourseInfo, waiting_list]

  data.close()

  return result

a new Course,with no students enroled Course(subjeet, number,seetion, cap, days,start_tin1e, dur) add_student a new student number is added(self, student_id} to the class list of the Course remove_student l a student number is removed(self, student_id} if it existed in the class listof the Courseoap1eaohed(self} True if the nmnber ofstudents em'oled in theCourse equals the sap size eonfliot[self, other) True if there is an],r overlapbetween the scheduled timeand days of self and other,returns False otherwisenurn_i_n_eo1n1non the nmnber of students{W} ——
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question