started main and fixed issue #7
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
import subject
|
||||||
|
import user_IO
|
||||||
|
|
||||||
|
subjects = []
|
||||||
|
while True:
|
||||||
|
user_input = user_IO.user_input()
|
||||||
|
if user_input[0] == "input":
|
||||||
|
if user_input[1] == "grade":
|
||||||
|
subject_edit = subject.get_subject(subjects, user_input[2])
|
||||||
|
if subject_edit:
|
||||||
|
subject_edit.add_grade(user_input[3], subject.Grade(user_input[4], user_input[5]))
|
||||||
|
|||||||
@@ -26,3 +26,10 @@ class Grade:
|
|||||||
self.grade = grade
|
self.grade = grade
|
||||||
self.name = name
|
self.name = name
|
||||||
self.date = date
|
self.date = date
|
||||||
|
|
||||||
|
|
||||||
|
def get_subject(liste, name):
|
||||||
|
for subject in liste:
|
||||||
|
if subject.name == name:
|
||||||
|
return subject
|
||||||
|
return None
|
||||||
|
|||||||
+3
-3
@@ -10,15 +10,15 @@ def user_input():
|
|||||||
user_add = input()
|
user_add = input()
|
||||||
if user_add == "subject":
|
if user_add == "subject":
|
||||||
subject = input("Which subject do you want to add? \n")
|
subject = input("Which subject do you want to add? \n")
|
||||||
return "input", subject
|
return "input", "subject", subject
|
||||||
elif user_add == "category":
|
elif user_add == "category":
|
||||||
subject = input("To which subject do you want to add the category? \n")
|
subject = input("To which subject do you want to add the category? \n")
|
||||||
category = input("Which category do you want to add? \n")
|
category = input("Which category do you want to add? \n")
|
||||||
rating = float(input("Rating? \n"))
|
rating = float(input("Rating? \n"))
|
||||||
return "input", subject, category, rating
|
return "input", "category", subject, category, rating
|
||||||
elif user_add == "grade":
|
elif user_add == "grade":
|
||||||
subject = input("To which subject do you want to add the grade? \n")
|
subject = input("To which subject do you want to add the grade? \n")
|
||||||
category = input("To which category do you want to add it? \n")
|
category = input("To which category do you want to add it? \n")
|
||||||
grade = input("Grade? \n")
|
grade = input("Grade? \n")
|
||||||
grade_name = input("What's the name of the grade? \n")
|
grade_name = input("What's the name of the grade? \n")
|
||||||
return "input", subject, category, grade, grade_name
|
return "input", "grade", subject, category, grade, grade_name
|
||||||
|
|||||||
Reference in New Issue
Block a user