Merge pull request #13 from lade043/main_names (Resolves Issue #11)

Main names
This commit was merged in pull request #13.
This commit is contained in:
lade043
2019-08-02 14:09:40 +02:00
committed by GitHub
2 changed files with 23 additions and 11 deletions
+22 -11
View File
@@ -5,19 +5,30 @@ subjects = []
try: try:
while True: while True:
user_input = user_IO.user_input() user_input = user_IO.user_input()
if user_input[0] == "input": input_or_output = user_input[0]
if user_input[1] == "grade": if input_or_output == "input":
subject_edit = subject.get_subject(subjects, user_input[2]) _edit = user_input[1]
_subject = user_input[2]
if _edit == "grade":
_category = user_input[3]
_grade = user_input[4]
_grade_name = user_input[5]
subject_edit = subject.get_subject(subjects, _subject)
if subject_edit: if subject_edit:
subject_edit.add_grade(user_input[3], subject.Grade(user_input[4], user_input[5])) subject_edit.add_grade(_category, subject.Grade(_grade, _grade_name))
elif user_input[1] == "category": elif _edit == "category":
subject_edit = subject.get_subject(subjects, user_input[2]) _category = user_input[3]
_rating = user_input[4]
subject_edit = subject.get_subject(subjects, _subject)
if subject_edit: if subject_edit:
subject_edit.add_grade_category(user_input[3], user_input[4]) subject_edit.add_grade_category(_category, _rating)
elif user_input[1] == "subject": elif _edit == "subject":
subjects.append(subject.Subject(user_input[2], user_input[3], user_input[4])) _main = user_input[3]
elif user_input[0] == "output": _oral = user_input[4]
subject_get = subject.get_subject(subjects, user_input[1]) subjects.append(subject.Subject(_subject, _main, _oral))
elif input_or_output == "output":
_subject = user_input[1]
subject_get = subject.get_subject(subjects, _subject)
user_IO.user_output(subject_get.return_average_subject) user_IO.user_output(subject_get.return_average_subject)
raise SystemError raise SystemError
+1
View File
@@ -1,4 +1,5 @@
def user_input(): def user_input():
print("Hi User, \n do you want to edit your grades?")
todo = input("Ok, do you want to see them or to edit them? [see/edit]\n") todo = input("Ok, do you want to see them or to edit them? [see/edit]\n")
if todo == "see": if todo == "see":
print("Which subject do you want to know the information?") print("Which subject do you want to know the information?")