def add_course_info(courses): print("Enter course info") id = int(input("ID:")) name = str(input("Name:")) course = Course(id, name) courses.append(course) print("This course is added")
def addCourses(): n = (int)(input("How many course(s) you want to add? ")) for i in range(n): id = (int)(input("Course's Id? ")) name = (str)(input("Course's name? ")) credit = (int)(input("Course's credit? ")) course = Course(id, name, credit) AllCourses.append(course)
def addCourse(): Courses =[] count = int(input("Number of courses")) for i in range(0,count): Name = input("Name") courseID = int(input("course ID")) c = Course(Name, courseID ) NumCo.append(c) return NumCo
def mark_student(): display_courses(courses) course = int(input("Which course? ")) found = Course(0, "Null") found = searchId(courses, course) for student in found.c1ass: print(f"Student: {student.Student}") mark = float(input("Input mark:")) student.Mark = math.floor(10 * mark) / 10
def course_info(c_count): c_list = [] for i in range(c_count): print("Course : ", i + 1) id = input("\tCourse ID : ") name = input("\tCourse Name : ") cre = float(input("\tCourse Credit : ")) credit = float(math.floor(cre)) c_list.append(C.Course(id, name, credit)) c_list = sorted(c_list, key=lambda x: x.id) return c_list
def add_course_info(courses): print("Enter course info") id = int(input("ID:")) name = str(input("Name:")) credit = int(input("Number of credit: ")) course = Course(id, name, credit) courses.append(course) print("This course is added") open = open("course.tex", "a") open.write(f"{id} {name} {credit} \n") open.close()
def markStudent(): display(AllCourses) course = (int)(input("Which course do you want to give marks? ")) foundCourse = Course(0, "Null", 0) foundCourse = searchId(AllCourses, course) while not foundCourse: course = (int)(input("Course not found! Try again? ")) foundCourse = searchId(AllCourses, course) for student in foundCourse.StudentsList: print(f"Student: {student.Student}") mark = (float)(input("Input mark for this student: ")) student.Mark = round(mark)
def inputCourses(): sc.addstr("Enter CourseID:") sc.refresh() cid = sc.getstr().decode() sc.addstr("Enter CourseName:") sc.refresh() name = sc.getstr().decode() sc.addstr("Enter CourseCredit:") sc.refresh() credit = float(sc.getstr().decode()) Course(cid, name, credit)
def addCourses(): dp.addstr("Enter CourseID:") dp.refresh() cid = dp.getstr().decode() dp.addstr("Enter CourseName:") dp.refresh() name = dp.getstr().decode() dp.addstr("Enter CourseCredit:") dp.refresh() credit = float(dp.getstr().decode()) Course(cid, name, credit)
def addCourses(): dp.addstr("Enter CourseID:") dp.refresh() cid = dp.getstr().decode() dp.addstr("Enter CourseName:") dp.refresh() name = dp.getstr().decode() dp.addstr("Enter CourseCredit:") dp.refresh() credit = float(dp.getstr().decode()) c = open("courses.txt", "w") c.write("Course id: " + cid + "\n" +"Course Name: " + name + "\n" + "Credit: " + str(credit) + "\n") c.close() Course(cid, name, credit)
def inputCourses(): py.addstr("Enter CourseID:") py.refresh() cid = py.getstr().decode() CoursesID.append(cid) py.addstr("Enter CourseName:") py.refresh() name = py.getstr().decode() CoursesName.append(name) py.addstr("Enter CourseCredit:") py.refresh() credit = float(py.getstr().decode()) Courses_credit.append(credit) Course(cid, name, credit)
def add_course(): screen.addstr("Enter Course ID: ") screen.refresh() id = screen.getstr().decode() screen.addstr("Enter the Name of Course: ") screen.refresh() name = screen.getstr().decode() screen.addstr("Enter Credit of Course: ") screen.refresh() credit = float(screen.getstr().decode()) c = Course(id, name, credit) courses.append(c) courseID.append(id) courseName.append(name) course_Credit.append(credit) screen.refresh() screen.clear()
def inputCourses(): sc.addstr("Enter CourseID:") sc.refresh() cid = sc.getstr().decode() sc.addstr("Enter CourseName:") sc.refresh() name = sc.getstr().decode() sc.addstr("Enter CourseCredit:") sc.refresh() credit = float(sc.getstr().decode()) if len(Courses) == 0: f = open("courses.txt", "w") else: f = open("courses.txt", "a") f.write(cid + "\n" + name + "\n" + str(credit) + "\n") f.close() Course(cid, name, credit)
def Cou(): cid = txt_couId.get() name = txt_couName.get() credit = txt_coucredit.get() if cid == "": messagebox.showerror(message="Error: Courses ID be empty") elif name == "": messagebox.showerror(message="Error: Courses Name be empty") elif credit == "": messagebox.showerror(message="Error: Courses credit be empty") else: CoursesID.append(cid) CoursesName.append(name) Courses_credit.append(credit) Course(cid, name, credit) messagebox.showinfo(message="Successfully added Courses ") cou.destroy()
def joinCourse(): display(AllCourses) course = (int)(input("Select the course Id you want student to join: ")) foundCourse = Course(0, "Null", 0) foundCourse = searchId(AllCourses, course) while not foundCourse: course = (int)(input("Course not found! Try again? ")) foundCourse = searchId(AllCourses, course) display(AllStudents) student = (int)( input("Select the Id of the student will join this course: ")) foundStudent = Student(0, "Null", "Null") foundStudent = searchId(AllStudents, student) while not foundStudent: student = (int)(input("Student not found? Try again? ")) foundStudent = searchId(AllStudents, student) mark = Mark(foundCourse, foundStudent, foundCourse.Credit) foundCourse.StudentsList.append(mark) foundStudent.CoursesList.append(mark)
def input_course(): id=txt_couId.get() name=txt_couName.get() credit=txt_coucredit.get() if id=="" : messagebox.showerror(message="Error: Please enter Courses ID") elif name=="": messagebox.showerror(message="Error: Please enter Courses Name") elif credit=="" : messagebox.showerror(message="Error: Please enter Courses Credit") else: c = Course(id,name,credit) courses.append(c) courseID.append(id) courseName.append(name) course_Credit.append(credit) messagebox.showinfo(message="Successfully added Course") course_screen.destroy()
def inputCourses(): py.addstr("Enter CourseID:") py.refresh() cid=py.getstr().decode() CoursesID.append(cid) py.addstr("Enter CourseName:") py.refresh() name=py.getstr().decode() CoursesName.append(name) py.addstr("Enter CourseCredit:") py.refresh() credit=float(py.getstr().decode()) Courses_credit.append(credit) if len(Courses) == 0: f = open("courses.txt", "w") else: f = open("courses.txt", "a") f.write(cid + "\n" + name + "\n" + str(credit) + "\n") f.close() Course(cid,name,credit)
def add_course(): screen.addstr("Enter Course ID: ") screen.refresh() id = screen.getstr().decode() screen.addstr("Enter the Name of Course: ") screen.refresh() name = screen.getstr().decode() screen.addstr("Enter Credit of Course: ") screen.refresh() credit = float(screen.getstr().decode()) f = open('Courses.txt','a') f.write("CourseID: " + id + "\n" + "CourseName: " + name + "\n" + "Course_credit: " + str(credit)) f.close() c = Course(id,name,credit) courses.append(c) courseID.append(id) courseName.append(name) course_Credit.append(credit) screen.refresh() screen.clear()
def initialize(self): # Creation des salles room1 = Room(number="EAU", seating_capacity=25) room2 = Room(number="BORDEAUX", seating_capacity=45) room3 = Room(number="ECHIQUIER", seating_capacity=35) self.rooms = [room1, room2, room3] # Creation des horaires meeting_time1 = MeetingTime(id="MT1", time="MWF 08:00 - 10:00") meeting_time2 = MeetingTime(id="MT2", time="MWF 10:00 - 12:00") meeting_time3 = MeetingTime(id="MT3", time="TTH 08:00 - 10:00") meeting_time4 = MeetingTime(id="MT4", time="TTH 10:00 - 12:00") self.meeting_times = [ meeting_time1, meeting_time2, meeting_time3, meeting_time4 ] # Creation des professeurs instructor1 = Instructor(id="I1", name="Algo teacher") instructor2 = Instructor(id="I2", name="AI teacher") instructor3 = Instructor(id="I3", name="Network teacher") instructor4 = Instructor(id="I4", name="Security teacher") instructor5 = Instructor(id="I5", name="English teacher") self.instructors = [instructor1, instructor2, instructor3, instructor4, instructor5] # Creation des cours course1 = Course(number="C1", name="ALGO", max_number_of_students=25, instructors=[instructor1, instructor2]) course2 = Course(number="C2", name="AI", max_number_of_students=35, instructors=[instructor1, instructor2, instructor3]) course3 = Course(number="C3", name="SECURITY", max_number_of_students=25, instructors=[instructor2, instructor4]) course4 = Course(number="C4", name="NETWORK", max_number_of_students=30, instructors=[instructor3, instructor4]) course5 = Course(number="C5", name="PYTHON", max_number_of_students=35, instructors=[instructor1]) course6 = Course(number="C6", name="DATA_MINING", max_number_of_students=45, instructors=[instructor1, instructor2]) course7 = Course(number="C7", name="GRAPH", max_number_of_students=45, instructors=[instructor3, instructor4]) course8 = Course(number="C8", name="JAVA", max_number_of_students=30, instructors=[instructor1, instructor3]) course9 = Course(number="C9", name="C++", max_number_of_students=25, instructors=[instructor2, instructor3]) course10 = Course(number="C10", name="LOGIC", max_number_of_students=30, instructors=[instructor1]) course11 = Course(number="C11", name="ENGLISH", max_number_of_students=25, instructors=[instructor5]) self.courses = [course1, course2, course3, course4, course5, course6, course7, course8, course9, course10, course11] # Create departments department1 = Department(name="3 INFO", courses=[course1, course3, course8]) department2 = Department(name="4 INFO", courses=[course2, course4, course5, course11]) department3 = Department(name="5 INFO", courses=[course6, course7, course9]) self.depts = [department1, department2, department3] # Definit le nombre de cours self.number_of_classes = sum([len(x.courses) for x in self.depts])
from domain.Student import * from domain.Course import * from domain.Mark import * screen = curses.initscr() screen.addstr("Enter number of students: ") nstu = int(screen.getstr().decode()) for i in range(0, nstu): s = Student("", "", "", "") s.input_sinfo() student_list.append(s) screen.addstr("Enter number of courses: ") ncourse = int(screen.getstr().decode()) for i in range(0, ncourse): c = Course("", "", "") c.input_cinfo() course_list.append(c) screen.addstr("__________Input mark for each course____________ \n") for j in range(len(course_list)): screen.addstr("for course {} \n".format(course_list[j].getcname())) for i in range(len(student_list)): mark = Mark(student_list[i], course_list[j], "") mark.inputmark() mark_list += [mark] screen.clear() screen.refresh()
nstu = int(screen.getstr().decode()) for i in range(0, nstu): s = Student("", "", "", "") s.input_sinfo() student_list.append(s) if len(student_list) == 0: f = open("students.txt", "w") else: f = open("students.txt", "a") f.write(s.getsid() + "\n" + s.getsname() + "\n" + s.getdob() + "\n" + str(s.getgpa()) + "\n") f.close() screen.addstr("Enter number of courses: ") ncourse = int(screen.getstr().decode()) for i in range(0, ncourse): c = Course("", "", "") c.input_cinfo() course_list.append(c) if len(course_list) == 0: f = open("courses.txt", "w") else: f = open("courses.txt", "a") f.write(c.getcid() + "\n" + c.getcname() + "\n" + str(c.getcredits()) + "\n") f.close() screen.addstr("__________Input mark for each course____________ \n") for j in range(len(course_list)): screen.addstr("for course {} \n".format(course_list[j].getcname())) for i in range(len(student_list)): mark = Mark(student_list[i], course_list[j], "")
def initialize(self): # create rooms room1 = Room(number="R1", seating_capacity=25) room2 = Room(number="R2", seating_capacity=45) room3 = Room(number="R3", seating_capacity=35) self.rooms = [room1, room2, room3] # create meeting times meeting_time1 = MeetingTime(id="MT1", time="MWF 09:00 - 10:00") meeting_time2 = MeetingTime(id="MT2", time="MWF 10:00 - 11:00") meeting_time3 = MeetingTime(id="MT3", time="TTH 09:00 - 10:00") meeting_time4 = MeetingTime(id="MT4", time="TTH 10:00 - 11:00") self.meeting_times = [ meeting_time1, meeting_time2, meeting_time3, meeting_time4 ] # creating instructors instructor1 = Instructor(id="I1", name="ALGO teacher") instructor2 = Instructor(id="I2", name="IS teacher") instructor3 = Instructor(id="I3", name="DBMS teacher") instructor4 = Instructor(id="I4", name="CI teacher") self.instructors = [instructor1, instructor2, instructor3, instructor4] # create courses course1 = Course(number="C1", name="ALGO", max_number_of_students=25, instructors=[instructor1, instructor2]) course2 = Course(number="C2", name="IS", max_number_of_students=35, instructors=[instructor1, instructor2, instructor3]) course3 = Course(number="C3", name="DBMS", max_number_of_students=25, instructors=[instructor1, instructor2]) course4 = Course(number="C4", name="CI", max_number_of_students=30, instructors=[instructor3, instructor4]) course5 = Course(number="C5", name="AI", max_number_of_students=35, instructors=[instructor4]) course6 = Course(number="C6", name="DATA_MINING", max_number_of_students=45, instructors=[instructor1, instructor3]) course7 = Course(number="C7", name="NETWORKS", max_number_of_students=45, instructors=[instructor2, instructor4]) self.courses = [ course1, course2, course3, course4, course5, course6, course7 ] # create departments department1 = Department(name="MSC", courses=[course1, course3]) department2 = Department(name="MCA", courses=[course2, course4, course5]) department3 = Department(name="BSC", courses=[course6, course7]) self.depts = [department1, department2, department3] # define the number of classes self.number_of_classes = sum([len(x.courses) for x in self.depts])