Merge pull request #14 from lade043/user_output
User output
This commit was merged in pull request #14.
This commit is contained in:
+3
-3
@@ -14,13 +14,13 @@ class Subject:
|
||||
def add_grade(self, category, 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]
|
||||
|
||||
def return_grade_categories(self):
|
||||
def return_grade_categories(self): # Return all categories
|
||||
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])
|
||||
|
||||
def return_average_of_subject(self):
|
||||
|
||||
+12
-7
@@ -1,16 +1,15 @@
|
||||
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":
|
||||
print("Which subject do you want to know the information?")
|
||||
subject = input()
|
||||
return "output", subject
|
||||
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()
|
||||
if user_add == "subject":
|
||||
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':
|
||||
main_subject = True
|
||||
elif main_subject == 'n':
|
||||
@@ -34,6 +33,12 @@ def user_input():
|
||||
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)
|
||||
def user_output(subject, categories, average, average_subject):
|
||||
print("\n\n In the subject {} are the following categories:".format(subject))
|
||||
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