Esempio n. 1
0
def student_input():
    #  Student_Details.student_info(operating_system)
    info = Student.get_user_input(operating_system)
    firstname = info['first_name']
    middlename = info['middle_name']
    lastname = info['last_name']
    age = info['age']
    gender = info['gender']
    department = info['department']
    course = info['course']
    new_student = Student(firstname, middlename, lastname, age, gender,
                          department, course)
    new_student.save_student_info(operating_system)
Esempio n. 2
0
    def students_DB(self):
        """ Structure: CWID, Name, Major
            reading in the students.txt file line by line, updating the basic info for one student
            also for each instance of students, passing in major info
        """
        for person_info in self.file_reader(self.students_path):
            CWID, name, major = person_info

            if major not in self.majors:
                raise ValueError(
                    'Error! Missing major {} information.'.format(major))

            if CWID not in self.students:
                self.students[CWID] = Student(person_info, self.majors[major])
Esempio n. 3
0
        user_input = int(user_input)

    except:
        continue

    # if user input equal to 1 gather student data.
    # check for validity and append it to list before asking for the next information.
    if user_input == 1:

        # Get student id and check for validity.
        # Append valid ID to college records.
        uid_ok = False
        while not uid_ok:

            sid = input('Enter Student ID: ')
            student = Student(user_id=sid)
            validate_student = Validator(user_id=student.user_id)

            if validate_student.ID_check(7) == 'None':
                print('UserID is not valid, please try again')
                uid_ok = False
            else:
                college_records.append(validate_student.ID_check(7))
                uid_ok = True

        # Get students email and check for validity.
        # Append valid email to college records.
        email_ok = False
        while not email_ok:
            email = input('Enter Student Email:')
Esempio n. 4
0
from person import Person, Student, Staff

student = Person("name", "address")

student = Student(student.name, student.address, "program", 1, 1)
student.Student()

student = Staff(student.name, student.address, "school", 1)
student.Staff()
Esempio n. 5
0
import csv
from person import Student

list_students = []

with open("students.csv") as in_file:
    reader = csv.reader(in_file)
    for row in reader:
        if len(row) >= 3:
            name, age, scholarship = row[0], row[1], row[2]
            student = Student(name, age, scholarship)
            list_students.append(student)

for student in list_students:
    print(student)
Esempio n. 6
0
## Ch10 P10.8

from person import Student, Instructor

s1 = Student('Bob', 1980, 'biology')
i1 = Instructor('Alex', 1989, 50000)
print(s1)
print(i1)
import csv
from person import Student

name = input("Your name:")
age = int(input("Your age:"))
scholarship = float(input("Your scholarship:"))

student = Student(name, age, scholarship)

with open("students.csv", 'a') as out_file:
    writer = csv.writer(out_file)
    writer.writerow(student.to_csv().split(','))

print("Success!")

Esempio n. 8
0
from person import Person, Student, Staff

tom = Person("Tom", "____")
tom.Person()

tom = Student("121", 2, 30000, tom.name, tom.address)
tom.Student()

tom = Staff("111q", 89, tom.name, tom.address)
tom.Staff()
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 15:17:54 2021

@author: oscbr226
"""

#Script to test classroom package

from person import Student
from person import Teacher

me = Student('Oscar', 'Brostrom', 'Biology')
me.printNameSubject()

teacher = Teacher('Filipe', 'Maia', 'Advanced Scientific Programming')
teacher.printNameCourse()
Esempio n. 10
0
 def test_child_class_student(self):
     """Testing an instance of class Student"""
     angie = Student("parallel student", "Angela", "Mutava")
     self.assertIsInstance(angie,
                           Student,
                           msg='The instance should be of class Student')
Esempio n. 11
0
def run_student_demo():
    """Run the demo from the student's POV"""
    # Create some fake tutors for the student to see
    t1 = Tutor("Brody", "Wilks", "*****@*****.**", 10, ["Math", "Science"])
    t2 = Tutor("Mary", "Hagan", "*****@*****.**", 12, ["English"])
    t3 = Tutor("Ray", "Maxwell", "*****@*****.**", 13,
               ["English", "History", "Science"])
    tutors = [t1, t2, t3]

    # Create some fake time slots
    timeslots = []
    for start_hour in range(16, 20):
        ts_start = datetime(2020, 9, 1, start_hour, 0, 0)
        ts_end = datetime(2020, 9, 1, start_hour + 1, 0, 0)
        timeslots.append(TimeSlot(ts_start, ts_end))

    # Add fake timeslots to the tutors
    for ts in timeslots:  # Tutor is free for all time slots
        tutors[0].add_session(ts)
    for ts in timeslots[:2]:  # Tutor is available for first two slots
        tutors[1].add_session(ts)
    for ts in timeslots[1:]:  # Tutor is available for last three
        tutors[2].add_session(ts)

    # Create fake student for demo
    student = Student("Test", "Student", "*****@*****.**", 5)

    # Define the various menus the student will see
    action_menu = [
        "Upcoming Sessions", "Book Session", "Unbook Session", "Exit"
    ]
    while True:
        action = get_option(action_menu)
        if action == action_menu[0]:
            # Display all sessions
            if student.get_upcoming_sessions():
                print("\nYour Upcoming Sessions: ")
                for session in student.get_upcoming_sessions():
                    print(session)
            else:
                print(
                    "\nYou have no sessions. Select 'Book Session' to get started."
                )
        elif action == action_menu[1]:
            # Student wants to book a session
            # Get all the info
            subject = get_option(
                get_all_subjects(tutors),
                title="What subject are you struggling with? ")
            sessions = get_subject_sessions(tutors, subject)
            session = get_option(sessions, title="Select a session: ")
            # Add student and subject to the  the session
            student.book_session(session, subject)
            # Get confirmation
            print(f"You are about to book {session}. ")
            confirm = input("Confirm? (y/n) ").lower().startswith("y")
            if confirm:
                print(f"Success! {session.tutor.get_contact_info()}.")
            else:
                print("Booking canceled.")
                student.unbook_session(session)
        elif action == action_menu[2]:
            # Student wants to unbook a session
            session = get_option(
                student.get_upcoming_sessions(),
                title="Which session would you like to unbook?")
            student.unbook_session(session)
        elif action == action_menu[3]:
            # Program is finished
            sys.exit()
Esempio n. 12
0
def run_tutor_demo():
    """Run the demo from the tutor's POV"""
    # Create the tutor and some fake data
    tutor = Tutor("Test", "Tutor", "*****@*****.**", 13,
                  ["Math", "Science"])

    # Create some fake time slots
    timeslots = []
    for start_hour in range(16, 20):
        ts_start = datetime(2020, 9, 1, start_hour, 0, 0)
        ts_end = datetime(2020, 9, 1, start_hour + 1, 0, 0)
        timeslots.append(TimeSlot(ts_start, ts_end))

    # Add the time slots to the tutor (as an example, this would be empty at first)
    for ts in timeslots:
        tutor.add_session(ts)

    # Fill some of the time slots (as an example, this would be empty at first)
    students = [
        Student("Ryan", "Choi", "*****@*****.**", 5),
        Student("Eliza", "Knox", "*****@*****.**", 7)
    ]
    students[0].book_session(tutor.sessions[0], "Science")
    students[1].book_session(tutor.sessions[3], "Math")

    # Define the menus
    actions_menu = [
        "Add Session", "Remove Session", "See Booked Sessions",
        "See Free Sessions", "Exit"
    ]
    while True:
        action = get_option(actions_menu)
        if action == actions_menu[0]:
            # Add a session
            # Ask for data about the session
            session_data = {}
            for data in ["year", "month", "day", "hour", "minute"]:
                ans = ""
                while not ans.isdigit():
                    ans = input(f"Enter session {data}: ")
                session_data[data] = int(ans)

            # Create the datetime objects and timeslot
            start = datetime(session_data["year"], session_data["month"],
                             session_data["day"], session_data["hour"],
                             session_data["minute"])
            end = datetime(session_data["year"], session_data["month"],
                           session_data["day"], session_data["hour"] + 1,
                           session_data["minute"])
            timeslot = TimeSlot(start, end)

            # Get conformation, then create the session
            session = Session(tutor, timeslot)  # Throwaway session
            confirm = input(
                f"You are about to create {session}.\nConfirm? (y/n) ").lower(
                ).startswith("y")
            if confirm:
                tutor.add_session(timeslot)
                print("Success!")
            else:
                print("No session created.")
        elif action == actions_menu[1]:
            # Remove a session
            session = get_option(
                tutor.get_free_sessions(),
                title="Which session would you like to remove?")
            # Confirmation
            confirm = input(
                f"You are about to delete {session}.\nConfirm? (y/n) ").lower(
                ).startswith("y")
            if confirm:
                tutor.remove_session(session)
                print("Session removed.")
            else:
                print("No session removed.")
        elif action == actions_menu[2]:
            # See booked sessions
            print("\nYour booked sessions:")
            for session in tutor.get_booked_sessions():
                print(session)
        elif action == actions_menu[3]:
            # See unbooked sessions
            print("\nYour unbooked sessions: ")
            for session in tutor.get_free_sessions():
                print(session)
        elif action == actions_menu[4]:
            sys.exit()
Esempio n. 13
0
from person import Person, Student, Book
"""
Instantiating a class works exactly like declaring a variable,
but the Class should have parantheses after, including all 
arguments passed to __init__
"""

if __name__ == "__main__":
    md = Book(1, "Moby Dick", "Herman Melville", 1755)

    sachin = Student("sachin", 20, 3)

    sachin.check_out_book(md)
    print(sachin.books)
course1 = Course('Foundations of Data Science', teacher1)
course2 = Course('Data Mining, Machine Learning and Deep Learning', teacher3)
course3 = Course('Visual Analytics Course', teacher2)
course4 = Course('Text Analytics Course', teacher3)

# Population the code with a programme
programme1 = Programme('Data Science')

# Adding the courses to a programme
programme1.add_course(course1)
programme1.add_course(course2)
programme1.add_course(course3)
programme1.add_course(course4)

# Population the code with students
student1 = Student('Allan', programme1)
student2 = Student('Bob', programme1)
student3 = Student('Lisa', programme1)
student4 = Student('Sally', programme1)
student5 = Student('Joey', programme1)

# Assigning grades to the assignments of each course.
# Every list represent the grades of a student in the course (based on the order of students in the course). 1 = pass and 0 = fail.
course1.assign_grades(course1.students,
                      [[1, 0, 0, 1, 1], [1, 1, 0, 1, 0], [1, 1, 1, 1, 0],
                       [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]])
course2.assign_grades(course2.students,
                      [[0, 1, 0, 0, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1],
                       [1, 0, 0, 0, 1], [1, 1, 0, 1, 1]])
course3.assign_grades(course3.students,
                      [[0, 0, 1, 0, 1], [1, 0, 1, 1, 0], [1, 1, 1, 1, 1],
Esempio n. 15
0
from person import Person, Student, Staff

student = Person("Artur", "Lviv, Drahomanova 50")

student = Student(student.name, student.address, "Belles", 4, 7)
student.Student()

student = Staff(student.name, student.address, "4", 17)
student.Staff()