User output #14
+3
-3
@@ -14,13 +14,13 @@ class Subject:
|
|||||||
def add_grade(self, category, grade):
|
def add_grade(self, category, grade):
|
||||||
self.grades[category][0].append(grade)
|
self.grades[category][0].append(grade)
|
||||||
|
|
||||||
def return_grades(self, category):
|
def return_grades(self, category): # Return all grades in one category
|
||||||
return self.grades[category][0]
|
return self.grades[category][0]
|
||||||
|
|
||||||
def return_grade_categories(self):
|
def return_grade_categories(self): # Return all categories
|
||||||
return [i for i in self.grades]
|
return [i for i in self.grades]
|
||||||
|
|
||||||
def return_average_of_category(self, category):
|
def return_average_of_category(self, category): # Return average of one categorie
|
||||||
return sum(self.grades[category][0]) / len(self.grades[category][0])
|
return sum(self.grades[category][0]) / len(self.grades[category][0])
|
||||||
|
|
||||||
def return_average_of_subject(self):
|
def return_average_of_subject(self):
|
||||||
|
|||||||
+12
-7
@@ -1,16 +1,15 @@
|
|||||||
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?")
|
||||||
subject = input()
|
subject = input()
|
||||||
return "output", subject
|
return "output", subject
|
||||||
elif todo == "edit":
|
elif todo == "edit":
|
||||||
print("Do you want to add a subject, a category or a grade? [subject/category/grade]")
|
print("Do you want to add a subject, a category or a grade [subject/category/grade]?")
|
||||||
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")
|
||||||
main_subject = input("Is this subject a main subject (Hauptfach)[y/n]? \n")
|
main_subject = input("Is this subject a main subject [y/n]? \n")
|
||||||
if main_subject == 'y':
|
if main_subject == 'y':
|
||||||
main_subject = True
|
main_subject = True
|
||||||
elif main_subject == 'n':
|
elif main_subject == 'n':
|
||||||
@@ -34,6 +33,12 @@ def user_input():
|
|||||||
return "input", "grade", subject, category, grade, grade_name
|
return "input", "grade", subject, category, grade, grade_name
|
||||||
|
|
||||||
|
|
||||||
def user_output(i):
|
def user_output(subject, categories, average, average_subject):
|
||||||
# just filled with some standard output, has to be filled further
|
print("\n\n In the subject {} are the following categories:".format(subject))
|
||||||
print(i)
|
for counter, category in enumerate(categories):
|
||||||
|
print("The average in {} is {} with these grades:".format(category, average[counter]))
|
||||||
|
string = ""
|
||||||
|
for grade in categories[category]:
|
||||||
|
string += str(grade) + ", "
|
||||||
|
print(string + "\n")
|
||||||
|
print("The average of {} is {}.".format(subject, average_subject))
|
||||||
|
|||||||
Reference in New Issue
Block a user