You are going to build a console application that tracks exercises that are assigned to students at Nashville Software School. These are the constraints and requirements for your application.
You must define a custom type for representing a student in code. A student can only be in one cohort at a time. A student can be working on many exercises at a time.
- First name
- Last name
- Slack handle
- The student's cohort
- The collection of exercises that the student is currently working on
You must define a type for representing a cohort in code.
The cohort's name (Evening Cohort 6, Day Cohort 26, etc.) The collection of students in the cohort. The collection of instructors in the cohort.
You must define a type for representing an instructor in code.
- First name
- Last name
- Slack handle
- The instructor's cohort
- The instructor's specialty (e.g. dad jokes, excitement, dancing, etc.)
- A method to assign an exercise to a student
You must define a type for representing an exercise in code. An exercise can be assigned to many students.
- Name of exercise
- Language of exercise (JavaScript, Python, CSharp, etc.)
The learning objective of this exercise is to practice creating instances of custom types that you defined with class
, establishing the relationships between them, and practicing basic data structures in Python.
First, build an ERD based on these above requirements using dbdiagram.io.
Note: Make sure that each class you define is in its own file.
mkdir -p ~/workspace/python/StudentExercises && cd $_
touch main.py student.py cohort.py instructor.py exercise.py
code .
Once you have defined all of your custom types, go to main.py, import the classes you need, and implement the following logic.
- Create 4, or more, exercises.
- Create 3, or more, cohorts.
- Create 4, or more, students and assign them to one of the cohorts.
- Create 3, or more, instructors and assign them to one of the cohorts.
- Have each instructor assign 2 exercises to each of the students.
Continuing inside of main.py
with the instances of the classes you made previously, create the lists below.
If I had a student instance referenced by the variable ivan
:
students = [ivan]
- Create a list of students. Add all of the student instances to it.
students = list()
- Create a list of exercises. Add all of the exercise instances to it.
exercises = list()
Now, generate a report that displays which students are working on which exercises.
Ivan is working on Kandy Korner, Stocks Report, and Planet List.