Merge branch 'master' of /home/lars/PycharmProjects/grade-program with conflicts.

This commit is contained in:
2019-07-31 19:59:11 +02:00
parent d91bc8f608
commit b8aef9ed66
2 changed files with 44 additions and 3 deletions
+25
View File
@@ -0,0 +1,25 @@
import subject
import user_IO
subjects = []
try:
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]))
elif user_input[1] == "category":
subject_edit = subject.get_subject(subjects, user_input[2])
if subject_edit:
subject_edit.add_grade_category(user_input[3], user_input[4])
elif user_input[1] == "subject":
subjects.append(subject.Subject(user_input[2], user_input[3], user_input[4]))
elif user_input[0] == "output":
subject_get = subject.get_subject(subjects, user_input[1])
user_IO.user_output(subject_get.)
raise SystemError
except Exception as e:
print('ERROR' + str(e))
+19 -3
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?")
@@ -9,15 +10,30 @@ 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 main_subject = input("Is this subject a main subject (Hauptfach)[y/n]? \n")
if main_subject == 'y':
main_subject = True
elif main_subject == 'n':
main_subject = False
oral_exam = input("Will there be an oral exam in this subject [y/n]? \n")
if oral_exam == 'y':
oral_exam = True
elif oral_exam == 'n':
oral_exam = False
return "input", "subject", subject, main_subject, oral_exam
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
def user_output(i):
# just filled with some standard output, has to be filled further
print(i)