def loadData(): with open("student.txt", "r") as stxt: lines = stxt.readlines() for line in lines: if (line): a = line.split(",") name = a[0] studentid = a[1] dob = a[2] gpa = a[3] students.append(student(name, dob, studentid)) with open("course.txt") as ctxt: lines = ctxt.readlines() for line in lines: if (line): a = line.split(",") name = a[0] courseid = a[1] etc = a[2] courses.append(course(name, courseid, etc)) with open("mark.txt") as mtxt: lines = mtxt.readlines() for line in lines: if (line): a = line.split(",") cid = a[0] sid = a[1] value = a[2] addMarkFunction(sid, cid, value)
def readAll(): with open("students","rb") as sfile: sts = (pickle.loads(sfile.read())) for s in sts: students.append(s) with open("marks","rb") as mfile: mks = pickle.loads(mfile.read()) for m in mks: marks.append(m) with open("courses","rb") as cfile: css = pickle.loads(cfile.read()) for c in css: courses.append(c)
def InputFunction(): nS=int(input("Num of students: ")) #intput stuendts for i in range (1,nS+1): id = input("Enter " + str(i) + " student ID: ") name = input("Student name: ") dob = input("Students's date of birth: ") students.append(student(name,dob,id)) #input courses nC = int(input("Enter number of courses: ")) for i in range(1,nC+1): id = input("Course ID: ") name = input("Course name: ") etc = input("How many etcs? ") courses.append(course(name,id,etc))
def lazyInput(): students.append(student("Nguyen Ngoc Anh","23/03/2001",10)) students.append(student("Tran Ngoc Hieu Nam","01/12/2001",54)) courses.append(course("Math",1,4)) courses.append(course("Python",2,3)) addMarkFunction(10,1,20) addMarkFunction(10,1,15) addMarkFunction(10,1,13.342) addMarkFunction(10,1,8.5) addMarkFunction(10,2,15) addMarkFunction(10,2,20) addMarkFunction(10,2,19) addMarkFunction(10,2,12) addMarkFunction(54,1,5) addMarkFunction(54,1,15) addMarkFunction(54,1,19.123) addMarkFunction(54,1,12) addMarkFunction(54,2,20.34) addMarkFunction(54,2,20) addMarkFunction(54,2,19) addMarkFunction(54,2,18)