Beispiel #1
0
def colorChecker():
    while True:  # search "one"
        if now.color == 2 or now.color == 3 or now.color == 4 or now.color == 5:  #
            one = now.color  # color number
            break
        elif now.color == 0 or now.color == 1 or now.color == 6 or now.color == 7:  # no color or black or white
            tank.on(15, 15)  # go ahead slight

    while True:  # search "two"
        if now.color == 2 or now.color == 3 or now.color == 4 or now.color == 5:  #
            two = now.color  # color number
            break
        elif now.color == 0 or now.color == 1 or now.color == 6 or now.color == 7:  # no color or black or white
            tank.on(15, 15)  # go ahead slight

    while True:  # search "three"
        if now.color == 2 or now.color == 3 or now.color == 4 or now.color == 5:  #
            three = now.color  # color number
            break
        elif now.color == 0 or now.color == 1 or now.color == 6 or now.color == 7:  # no color or black or white
            tank.on(15, 15)  # go ahead slight

    while True:  # search "four"
        if now.color == 2 or now.color == 3 or now.color == 4 or now.color == 5:  #
            four = now.color  # color number
            break
        elif now.color == 0 or now.color == 1 or now.color == 6 or now.color == 7:  # no color or black or white
            tank.on(15, 15)  # go ahead slight

    tank.on_for_rotations(50, -50, 0.46)  # turn 90  degrees clock wise
    tank.on_for_rotations(50, 50, 2)

    while True:
        if now.color == 1:
            break
        elif now.color != 1:
            tank.on(10, 10)

    print(one)
    print(two)
    print(three)
    print(four)

    course(one, two, three, four)

    return (
        one,
        two,
    )
class main:
    # crate teacher and course

    muhammedotun = Teacher(1, "muhammed", "Ötün")
    python101 = course("python101", muhammedotun, 3)

    # crate teacher and course

    # crate list
    studentList = []

    # create list

    def addStudent(studentList, stdNumber, stdName, stdLastName):
        studentList.append(Student(stdNumber, stdName, stdLastName))

    def printStudentList(studentList):
        for student in studentList:
            student.printStudent()

    addStudent(studentList, 1, "emirhan", "eren")
    addStudent(studentList, 2, "yahya furkan", "kılıçoğlu")
    addStudent(studentList, 3, "onur", "kerim")
    addStudent(studentList, 4, "kasım", "eren")

    printStudentList(studentList)

    studentList[0].addCourse(python101)

    print(help(Student))
Beispiel #3
0
def getcourse(id):
    list = []
    listofstrings = []
    mydb = mysql.connector.connect(
        user="******",
        password="******",
        host="SG-HackAU-634-master.servers.mongodirector.com",
        port=3306,
        database="hackau",
        collation='utf8_general_ci',
        use_unicode=True,
        charset='utf8')
    mycursor = mydb.cursor()
    mycursor.execute(
        "SELECT Name_Lecturer, courses.Name_Courses, courses.Course_ID, " +
        "Time_Begin, Time_End ,courses.Credits ,semester,day from lectures INNER JOIN courses on lectures.Course_ID = courses.Course_ID where department = 'מדעי המחשב' and (Name_Courses='{}' or Name_Courses='{}-תרגיל');"
        .format(id, id))
    myresult = mycursor.fetchall()
    for row in myresult:
        # print(u'{} {} {} {} {} ({}'.format(*i[:]))
        c = course.course(u'{}'.format(row[0]), u'{}'.format(row[1]), row[2],
                          row[3], row[4], row[5], row[6])
        list.append(c)
        listofstrings.append(c.myfunc())
    return render_template('main.html', rellist=listofstrings)
Beispiel #4
0
 def __parse(self,source):
     res = BeautifulSoup(source)
     courses_containing_nodes = res.find_all("li", class_="d2l-itemlist-simple d2l-itemlist-arrow d2l-itemlist-short")
     ids = self.__course_id_match_pattern.finditer(source)
     for course_containing_node in courses_containing_nodes:
         strings = course_containing_node.stripped_strings
         m = self.__course_match_pattern.match(strings.next())
         if m != None:
             c = course.course(m.group(1),m.group(2),m.group(3),m.group(4),m.group(5),m.group(6),ids.next().group(1), self.session)
             self.user.courses.append(c)
Beispiel #5
0
def run(sD):
    #organize the course info for the user
    course1 = course.course(clean(sD[3]),sD[4],sD[5],sD[6])
    course2 = course.course(clean(sD[7]).lower(),sD[8],sD[9],sD[10])
    course3 = course.course(clean(sD[11]).lower(),sD[12],sD[13],sD[14])
    course4 = course.course(clean(sD[15]).lower(),sD[16],sD[17],sD[18])
    courses = [course1,course2,course3,course4]
    sem = semester.semester(courses)
    
    #get the data from the database
    students = data_parser.getStudents()
    courseData = data_parser.getCourses()
    concentrations = data_parser.getConcentrations()
    
    #run the algorithm
    alg = algorithm.algorithm(sem,sD[0],sD[1],sD[2],
                              sD[19],sD[20],sD[21],
                              students, courseData, concentrations)
    recs = alg.values()
    
    #get a sorted list of the courses by their weights
    keys = sorted(recs.keys(), reverse=True)
    #number of courses to return
    numWanted = 10
    totalRecs = 0
    #list of recommended courses
    recList = []

    #loop through rec dictionary to get courses
    for key in keys:
        if (totalRecs >= numWanted):
            break
        else:
            #check for length in case >1 course has the same value
            length = len(recs[key])
            for i in range(0, length):
                if (totalRecs >= numWanted):
                    break
                else:
                    recList.append(recs[key][i])
                    totalRecs += 1
    return recList
Beispiel #6
0
def addMessages(messages):
    desiredClasses = []
    for message in messages:
        courseArr = message.body.split(" ")
        if len(courseArr) == 3 and len(courseArr[0]) == 4 and len(
                courseArr[1]) == 3 and len(courseArr[2]) == 3:
            if courseArr[0].isalpha() and courseArr[1].isnumeric(
            ) and courseArr[2].isnumeric():
                desiredClass = c.course(courseArr[0], int(courseArr[1]),
                                        int(courseArr[2]))
                desiredClasses.append(desiredClass)
    return desiredClasses
Beispiel #7
0
def main():
    user = User()
    user.login()
    courses_list = main_page()
    abstracts = []
    for name, href in courses_list:
        abstracts.append(course(name, href))
    abstracts = [_ for _ in abstracts if _.strip()]
    if abstracts:
        print('-' * 40, '\n'.join([_ for _ in abstracts]), sep='\n')
        print('-' * 40)
        print('请登录http://tkkc.hfut.edu.cn **提交作业**, 未完成的题目还需自行补题')
Beispiel #8
0
 def make_new_course(self, difficulty, review, grade, course_id):
     errors = MakeCourseError({})
     errsFound = errors.check_make_course_error(difficulty, review, grade,
                                                course_id)
     print(errsFound)
     if errsFound != {}:
         raise MakeCourseError(errors)
     else:
         if (self.check_course_addable(course_id)):
             newC = course(difficulty, review, grade, course_id)
             self.add_course(newC)
             return newC
Beispiel #9
0
 def setUp(self):
     self.new_basic = basic("john", "cs", "2022")
     self.new_contact_info = contact_info("703", "vt.edu", "addy")
     self.course_list = course_list()
     self.new_course = course("1215", "engineering", "2")
     self.course_list.add(self.new_course)
     self.new_questions = questions()
     self.new_questions.set_one("one")
     self.new_questions.set_two("two")
     self.new_questions.set_three("three")
     self.new_questions.set_four("four")
     self.new_applicant = applicant(self.new_basic, self.new_contact_info,
                                    self.course_list, self.new_questions)
Beispiel #10
0
def bootstrap_system():

	system = uwswSystem()
	system.add_user(user("1111111", "passDean"))
	'''
	with open('user.csv') as csv_file:
		reader = csv.reader(csv_file)
		next(reader, None)  # Skip the header
		# Unpack the row directly in for loop
		for difficulty, review, grade, course_id in reader:
			system.add_course(Course(difficulty, review, grade, course_id))
	'''
	system.add_course(course("2", "blah", "80", "COMP1511"));
	return system
Beispiel #11
0
def get_course_str(full_data=False):
    current_course = course()
    l = ["Код валюты: %d; ID валюты: %s\n%d %s (%s): %f ₽" % (i['num_code'], i['id'],
                                                              i['nominal'], i['char_code'],
                                                              i['name'], i['value']) for i in current_course['course']]
    if not full_data:
        for i in range(len(l)):
            l[i] = l[i].split('\n')[1]

    text = '\n\n'.join(l)
    time = current_course['time']
    res = "Курс валют на %.2d.%.2d.%.4d %.2d:%.2d:\n\n" % (time['day'], time['month'],
                                                           time['year'], time['hour'],
                                                           time['minutes']) + text
    return '\n'.join(res.split('\n\n')) if not full_data else res
Beispiel #12
0
def students_from_file(input_file):
    """
    Checks for line prefixes which are variables in the student object
    
    """
    student_list = []
    cList = []
    student_placeholder = {}
    courses_placeholder = {}
    lines = [line.rstrip("\n") for line in open(input_file)]
    for line in lines:
        if "____" in line:
            student_list.append(
                student(
                    name=student_placeholder["name"],
                    data_sheet=data_sheet(courses=cList.copy()),
                    gender=student_placeholder["gender"],
                    image_url=student_placeholder["image_url"],
                ))
            student_placeholder.clear()
            cList.clear()
        elif "name: " in line and not "_name" in line:
            student_placeholder["name"] = " ".join(line.split()[1:])
        elif "gender: " in line:
            student_placeholder["gender"] = " ".join(line.split()[1:])
        elif "course_name: " in line:
            courses_placeholder["name"] = " ".join(line.split()[1:])
        elif "teacher" in line:
            courses_placeholder["teacher"] = " ".join(line.split()[1:])
        elif "ects" in line:
            courses_placeholder["ECTS"] = " ".join(line.split()[1:])
        elif "grade" in line:
            courses_placeholder["optional_grade"] = " ".join(line.split()[1:])
            if courses_placeholder:
                cList.append(
                    course(
                        name=courses_placeholder["name"],
                        teacher=courses_placeholder["teacher"],
                        ECTS=courses_placeholder["ECTS"],
                        optional_grade=courses_placeholder["optional_grade"],
                        class_room=courses_placeholder["class_room"],
                    ))
                courses_placeholder.clear()
        elif "classroom" in line:
            courses_placeholder["class_room"] = " ".join(line.split()[1:])
        elif "img_url" in line:
            student_placeholder["image_url"] = " ".join(line.split()[1:])
    return student_list
Beispiel #13
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setupUi(self)
     self.db = Model()
     self.tabes_data = {
         u'حضور الطلاب': student_enter(),
         u'الطالب': student(),
         u'المجموعات': course(),
         u'الاختبارات': exam(),
         u'تقرير المجموعات': Report_all(),
         u'تقرير الطالب': st_report(),
         u'تقرير الماليه': report(),
         u'المستخدمين': permissions()
     }
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     for i in self.widget_3.findChildren(QToolButton):
         i.clicked.connect(self.pr_lst)
     self.h.tabCloseRequested.connect(self.removeTab)
     self.h.currentChanged.connect(self.tab_select)
def getStudents() :
    students = []
    dump = []
    
    #open the file
    with open("sample_students.txt") as file:
        for line in file:
            currentline = (line.rstrip("\n")).split(","),
            dump.append(currentline)
    
    # go over the rows of the data dump
    for x in range(len(dump)):
        #if the current row's first term is 0, 
        #it's a new student so create a new student object
        if (dump[x][0][0] == "0"):
            new_semesters = []
            # variable to track when to stop adding data to the new student object
            y = 1
      
            while ((x+y) < len(dump) and dump[x+y][0][0] != "0"):
                #variable to store courses
                curCourses = []
                #loop over a semester
                for z in range(int((len(dump[x+y][0]) - 1) / 4)):
                    curCourses.append(course.course(clean(dump[x+y][0][4 * z + 1]), 
                                                    int(dump[x+y][0][4 * z + 2]), 
                                                    int(dump[x+y][0][4 * z + 3]), 
                                                    int(dump[x+y][0][4 * z + 4])))
                #add the semester into the array of semesters  
                sem = semester.semester(curCourses)
                new_semesters.append(sem)
                y = y + 1
            #create a new student object   
            new_student = student.student(dump[x][0][2], new_semesters, dump[x][0][1], "")
            students.append(new_student)
            
    return students
Beispiel #15
0
def main(requestedCourses):
    global genId
    genId = []
    courses = []
    for section in requestedCourses:
        courses.append(
            course.course(["201805", section["fos"], section["num"]]))
    '''course1 = course.course(["201805", "ASTR", "101"])
    course2 = course.course(["201805", "ECON", "180"])
    course3 = course.course(["201805", "CSC", "225"])
    course4 = course.course(["201805", "SENG", "275"])
    course5 = course.course(["201805", "SENG", "310"])
    list = [course1, course2 , course3, course4, course5]'''
    newList = constructList(courses)
    possibility = []
    generateCalendar(newList, possibility)

    #print(json.JSONEncoder().encode(genId))
    temp = json.JSONEncoder().encode(toJson())
    #print(temp)
    file = open("./static/tempsend.txt", "w")
    file.write(temp)
    file.close()
    return temp
Beispiel #16
0
import random
import matplotlib.pyplot as plt
from course import Course as course
from data_sheet import DataSheet as data_sheet
from student import Student as student
from exceptions import NotEnoughStudentsException

course_list = [
    course(
        name="Astrophysics",
        class_room="902",
        teacher="Henry the 2nd",
        ECTS="25",
        optional_grade="0",
    ),
    course(
        name="Fishing",
        class_room="Swimming Pool",
        teacher="Michael Jackson",
        ECTS="25",
        optional_grade="0",
    ),
    course(
        name="How to be a god",
        class_room="Olympus",
        teacher="Chronos, Titan of Time",
        ECTS="25",
        optional_grade="0",
    ),
    course(
        name="Curling",
Beispiel #17
0
 def test_remove(self):
     new_course = course(1026, "history", 3)
     self.new_course.add(new_course)
     self.assertFalse(self.new_course.is_empty())
     self.assertTrue(self.new_course.remove(new_course))
     self.assertEqual(0, self.new_course.get_num_entries())
Beispiel #18
0
	def bCourseAdd_handler(self,e):
		courses.append(course(self.tab2.txtCourseID.GetValue(), self.tab2.txtCourseName.GetValue()))
		self.tab3.lbCourse_Update(courses[-1])
		self.SetStatusbar('Course Added: ' + self.tab2.txtCourseName.GetValue())
		self.tab2.Reset()
Beispiel #19
0
import requests
import login
import info
import course
import datebase
import sys

org = {}
stu = {}

if len(sys.argv) != 4:
    print('false 缺少参数')
    sys.exit()

org['code'] = sys.argv[1]
stu['id'] = sys.argv[2]
stu['pwd'] = sys.argv[3]
org = datebase.org_info(org)

session = requests.Session()
login.login(session, stu)
stu['info'] = info.information(session)
stu['course'] = course.course(session, org)
datebase.storage_data(org, stu)
print("true")
sys.exit()
Beispiel #20
0
 def test_remove_2(self):
     new_course = course(1026, "history", 3)
     self.assertFalse(self.new_course.remove(new_course))
Beispiel #21
0
    server = 'QICAI'
    database = 'student'
    username = '******'
    password = '******'
    cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER=' +
                          server + ';DATABASE=' + database + ';UID=' +
                          username + ';PWD=' + password)
    return cnxn


if __name__ == "__main__":
    s2 = professor("li", "hao", 1)
    print(s2.firstName)

    cnxn = createConnectionToDB()
    s1 = course(1, "english", 40, 1)
    cmd = s1.insert()
    print(cmd)
    query(cnxn, cmd)
    s1 = course(2, "physics", 45, 2)
    cmd = s1.insert()
    query(cnxn, cmd)

    cursor = cnxn.cursor()
    cursor.execute("SELECT * from students;")
    row = cursor.fetchone()
    while row:
        print(row.firstName)
        print(row.lastName)
        print(row.id)
        row = cursor.fetchone()
Beispiel #22
0
 def test_total_credits(self):
     new_course = course(1026, "history", 3)
     self.new_course.add(new_course)
     n_course = course(1114, "cs", 4)
     self.new_course.add(n_course)
     self.assertEqual(7, self.new_course.total_credits())
Beispiel #23
0
class Ui_Form(QWidget):

    cour = course('网络编程', getNameList())

    def restart_list(self):
        self.cour.singOut = getNameList()
        self.cour.signIn = []

    def turn_off(self):
        os._exit(0)

    def setupUi(self):
        self.resize(762, 730)
        self.label = QtWidgets.QLabel(self)
        self.label.setGeometry(QtCore.QRect(250, 10, 261, 41))
        self.label.setObjectName("label")
        self.radioButton = QtWidgets.QRadioButton(self)
        self.radioButton.setGeometry(QtCore.QRect(30, 90, 115, 19))
        self.radioButton.setObjectName("radioButton")
        self.radioButton_2 = QtWidgets.QRadioButton(self)
        self.radioButton_2.setGeometry(QtCore.QRect(180, 90, 115, 19))
        self.radioButton_2.setObjectName("radioButton_2")
        self.radioButton_3 = QtWidgets.QRadioButton(self)
        self.radioButton_3.setGeometry(QtCore.QRect(320, 90, 115, 19))
        self.radioButton_3.setObjectName("radioButton_3")
        self.radioButton_4 = QtWidgets.QRadioButton(self)
        self.radioButton_4.setGeometry(QtCore.QRect(610, 90, 115, 19))
        self.radioButton_4.setObjectName("radioButton_4")
        self.radioButton_5 = QtWidgets.QRadioButton(self)
        self.radioButton_5.setGeometry(QtCore.QRect(470, 90, 115, 19))
        self.radioButton_5.setObjectName("radioButton_5")
        self.sign_in = QtWidgets.QLabel(self)
        self.sign_in.setGeometry(QtCore.QRect(30, 190, 531, 241))
        self.sign_in.setObjectName("sign_in")
        self.sign_in.setFrameShape(QtWidgets.QFrame.Box)
        self.sign_in.setStyleSheet('background-color: rgb(255, 255, 255)')
        self.sign_in.setLineWidth(1)
        self.sign_out = QtWidgets.QLabel(self)
        self.sign_out.setGeometry(QtCore.QRect(30, 470, 531, 241))
        self.sign_out.setObjectName("sign_out")
        self.sign_out.setFrameShape(QtWidgets.QFrame.Box)
        self.sign_out.setStyleSheet('background-color: rgb(255, 255, 255)')
        self.sign_out.setLineWidth(1)
        self.course_connect_status = QtWidgets.QLabel(self)
        self.course_connect_status.setGeometry(QtCore.QRect(30, 130, 651, 31))
        self.course_connect_status.setObjectName("course_connect_status")
        self.pushButton = QtWidgets.QPushButton(self)
        self.pushButton.setGeometry(QtCore.QRect(610, 380, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.pushButton.clicked.connect(self.restart_list)
        self.time = QtWidgets.QLabel(self)
        self.time.setGeometry(QtCore.QRect(30, 50, 651, 31))
        self.time.setObjectName("time")

        self.pushButton_2 = QtWidgets.QPushButton(self)
        self.pushButton_2.setGeometry(QtCore.QRect(610, 560, 93, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.pushButton_3 = QtWidgets.QPushButton(self)
        self.pushButton_3.setGeometry(QtCore.QRect(610, 470, 93, 28))
        self.pushButton_3.setObjectName("pushButton_3")
        self.pushButton_2.clicked.connect(self.turn_off)
        self.setWindowTitle('人脸考勤系统服务器 v1.0')
        self.retranslateUi()
        self.show()

    def retranslateUi(self):
        _translate = QtCore.QCoreApplication.translate
        self.setWindowTitle(_translate("Form", "人脸考勤系统服务器 v1.0"))
        self.label.setText(
            _translate(
                "Form",
                "<html><head/><body><p><span style=\" font-size:15pt; font-weight:600;\">智慧教室人脸考勤系统    </span></p></body></html>"
            ))
        self.radioButton.setText(_translate("Form", "南湖一教一阶"))
        self.radioButton_2.setText(_translate("Form", "南湖一教二阶"))
        self.radioButton_3.setText(_translate("Form", "南湖一教六阶"))
        self.radioButton_4.setText(_translate("Form", "南湖三教103"))
        self.radioButton_5.setText(_translate("Form", "南湖一教327"))
        self.sign_in.setText(_translate("Form", "已签到列表"))
        self.sign_out.setText(_translate("Form", "未签到列表"))
        self.course_connect_status.setText(_translate("Form", "未连接客户端......"))
        self.pushButton.setText(_translate("Form", "签到复位"))
        self.time.setText(
            time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) +
            '                                  当前课程:网络编程')
        self.time.setFont(QFont("微软雅黑", 10, QFont.Bold))
        self.pushButton_2.setText(_translate("Form", "退出系统"))
        self.pushButton_3.setText(_translate("Form", "课程列表"))

    def execute(self):
        recv_reply(self, self.cour)

    def timeinfo(self):
        self.time.setText(
            time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) +
            '                               当前课程:网络编程')
        self.time.setFont(QFont("微软雅黑", 10, QFont.Bold))
Beispiel #24
0
def getAvg(courses_list, course_num):
    sum = 0
    for i in range(0, course_num):
        sum = courses_list[i].getCourseGrade()+ sum
        avg = sum/course_num
    return avg
def printReport(courses_list, average, course_num):
    print('REPORT CARD:\n')
    print('\n')
    for i in range(0, course_num):
        print(courses_list[i].getCourseName(), '  -  ', courses_list[i].getCourseGrade())
    print('\n')
    print('Overall GPA –  ', average)

print('Welcome to this GPA helper')
course_num = int(input('How many classes did you take? '))
if(course_num > MAX_COURSE_LIMIT or course_num < 1):
    print('NOT VALID COURSES')
    sys.exit()
for i in range(0, course_num):
    my_course_name = input('What was the name of this class? ')
    my_course_grade = int(input('What was your grade'))
    my_course = course(my_course_name, my_course_grade)
    courses_list.append(my_course)

#print(courses_list)
average = getAvg(courses_list,course_num)
#print('The avg is :', average)
printReport(courses_list, average, course_num)
Beispiel #25
0
def courseEdit():
    command = ''
    while (command.lower() != 'x'):
        print('''
1 - Create course
2 - Edit course info
3 - Delete course
4 - Enroll student
5 - Drop student
6 - Edit Grade
7 - Dsiplay CRF of student
8 - View top Notchers of a course
X - Cancel
''')
        norm = [
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
            'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-'
        ]
        command = input('Enter command: ')
        if (command == '1'):
            ccode = input('Enter course code: ')
            if (len(ccode) != 7 or followsFormat(ccode, norm) == False):
                print('Invalid input')
                return False
            try:
                units = float(input('Enter unit: '))
                if (units > 4 or units < 0 or units % 0.5 != 0):
                    print('Invalid input')
                    return False

                if (checkIfExist(ccode, courses) is not None):
                    print('Course code already taken!')
                    return False
                courses.append(course.course(ccode, units))
                print('Course Added!')
            except:
                print('please put a floating number for units.')
        elif (command == '2'):
            ccode = input('Enter course code: ')
            corth = checkIfExist(ccode, courses)
            if (corth is None):
                print('Course does not exist!')
                return False
            print('''
1. Edit Course Code
2. Edit Units
''')
            command2 = input('Enter command: ')
            if (command2 == '1'):

                IamStressed = input('Enter Mo to: ')
                if (len(IamStressed) != 7
                        or followsFormat(IamStressed, norm) == False):
                    print('Invalid input')
                    return False
                if (checkIfExist(IamStressed, courses) is not None):
                    print('Course code already taken!')
                    return False
                corth.setCode(IamStressed)
                print('Course Code changed!')
            elif (command2 == '2'):
                IamStressed = input('Enter units: ')
                if (IamStressed != 'floating' and IamStressed != '0'
                        and IamStressed != '0.5' and IamStressed != '1'
                        and IamStressed != '2' and IamStressed != '3'
                        and IamStressed != '4'):
                    print('Invalid input')
                    return False
                corth.setUnits(IamStressed)
                print('Course unit changed!')
            else:
                print('Invalid input!')
        elif (command == '3'):
            ccode = input(
                'Enter course code of the couse you want to remove: ')
            corth = checkIfExist(ccode, courses)
            if (corth is None):
                print('Course does not exist!')
                return False

            for i in students:
                if (i.getClass(ccode) is not None):
                    i.removeClass(ccode)
            courses.remove(corth)

        elif (command == '4'):

            corth, stud = GetTriggeredWithMyMethodNames()
            if (corth is None or stud is None): return False
            if (stud.checkIfStudentIsHere(corth.getCode())):
                print('Student is already enrolled!')
                return False
            print(
                str(stud.getCode()) + ' is now enrolled to ' +
                str(corth.getCode()))
            corth.addStudent(stud, 0)
        elif (command == '5'):
            corth, stud = GetTriggeredWithMyMethodNames()
            if (corth is None or stud is None): return False
            truth = corth.dropStudent(stud)
            if (truth == True):
                print('Student dropped!')
            else:
                print('Student is not enrolled in that course.')
        elif (command == '6'):
            corth, stud = GetTriggeredWithMyMethodNames()
            if (corth is None or stud is None): return False
            if (stud.checkEnroll(corth.getCode()) == False):
                print('Student is not enrolled in that course!')
                return False
            try:
                grade = float(input('Enter grade for student: '))
                if ((grade == 0.0 or grade <= 4.0 and grade >= 1.0)
                        and (grade % 0.5 == 0)):
                    if (stud.editGrade(corth.getCode(), grade)):
                        print('Grades changed!')
                else:
                    print(
                        'Invalid grade, please choose a legit Lasallian grade ;)'
                    )
            except:
                print('you gave an invalid character input lol')
        elif (command == '7'):
            studid = input('Enter ID # of the student you want to enlist po:')
            stud = checkIfExist(studid, students)
            if (stud is None):
                print('Student does not exist!')
                return False
            stud.displayGrade()

        elif (command == '8'):
            ccode = input('Enter course you want a student to enlist into po:')
            corth = checkIfExist(ccode, courses)
            if (corth is None):
                print('Course does not exist!')
                return False
            corth.getTopNotchers()
        elif (command == '9'):
            #y the nuggets doesnt python have RelativeToNull? what is this complicated stuff for making a gui centered? o.o
            screen = Tk()
            lab0 = Label(screen,
                         text=str('Course code'),
                         borderwidth=2,
                         relief="solid")
            lab0.grid(row=0, column=0)
            lab1 = Label(screen, text='Units', borderwidth=2, relief="solid")
            lab1.grid(row=0, column=1)
            cnt = 1
            for i in courses:
                lab0 = Label(screen, text=str(i.getCode()))
                lab0.grid(row=cnt, column=0)
                lab1 = Label(screen, text=str(i.getUnits()))
                lab1.grid(row=cnt, column=1)
                cnt = cnt + 1
        else:
            print('invalid po')
Beispiel #26
0
            sad.write(str(i.getCode()) + ',' + str(i.getName()))
            cortheth = list(i.getClasses().values())
            for i in cortheth:
                sad.write(',')
                sad.write(str(i[0].getCode()))
                sad.write(',')
                sad.write(str(i[1]))
            sad.write('\n')
        sad.close()


atexit.register(goodbye)
try:
    lishy = open('Courses.txt', 'r').read().splitlines()
    for i in lishy:
        lishy2 = i.split(',')
        courses.append(course.course(lishy2[0], lishy2[1]))

    lishy = open('Students.txt', 'r').read().splitlines()
    for i in lishy:
        lishy2 = i.split(',')
        stud = student.student(lishy2[1], lishy2[0])
        students.append(stud)
        for i in range(2, len(lishy2)):
            if (i % 2 == 0):
                corth = checkIfExist(lishy2[i], courses)
                corth.addStudent(stud, lishy2[i + 1])
except:
    None
main()
Beispiel #27
0
 def setUp(self):
     self.new_course = course(1215, "engineering", 2)