From 1d8cc36b0a2defae9ccdee718a2bc7b7246d0580 Mon Sep 17 00:00:00 2001 From: tstst334 Date: Tue, 30 Jul 2019 07:23:58 -0700 Subject: [PATCH 1/5] edit user IO --- user_IO.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 user_IO.py diff --git a/user_IO.py b/user_IO.py new file mode 100644 index 0000000..e2e62a6 --- /dev/null +++ b/user_IO.py @@ -0,0 +1,16 @@ +def userinput(): + 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") + 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]") + useradd = input() + if useradd == "subject": + subject = input("Which subject do you want to add? \n") + return "input", subject + elif todo == "category": + subject = input("Where do you want to add the category? \n") + category = input("Which category do you want ot add? \n") \ No newline at end of file -- 2.39.5 From f5259dfe8ef41cc9ab9ffc56be04291f87953e84 Mon Sep 17 00:00:00 2001 From: tstst334 Date: Tue, 30 Jul 2019 07:40:22 -0700 Subject: [PATCH 2/5] edit user IO --- user_IO.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/user_IO.py b/user_IO.py index e2e62a6..c53e577 100644 --- a/user_IO.py +++ b/user_IO.py @@ -12,5 +12,14 @@ def userinput(): subject = input("Which subject do you want to add? \n") return "input", subject elif todo == "category": - subject = input("Where do you want to add the category? \n") - category = input("Which category do you want ot add? \n") \ No newline at end of file + subject = input("To which subject do you want to add the category? \n") + category = input("Which category do you want to add? \n") + rating = float(input("Rating? \n")) + return "input", subject, category, rating + elif todo == "grade": + 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") + grade = input("Grade? \n") + gradename = input("What's the name of the grade? \n") + return "input", subject, category, grade, gradename + -- 2.39.5 From a9882dbd77a07abd2ba607ba8a926081af54f5a5 Mon Sep 17 00:00:00 2001 From: tstst334 Date: Tue, 30 Jul 2019 07:43:42 -0700 Subject: [PATCH 3/5] edit user IO --- user_IO.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/user_IO.py b/user_IO.py index c53e577..7fcc4d1 100644 --- a/user_IO.py +++ b/user_IO.py @@ -1,4 +1,4 @@ -def userinput(): +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") if todo == "see": @@ -7,19 +7,18 @@ def userinput(): return "output", subject elif todo == "edit": print("Do you want to add a subject, a category or a grade? [subject/category/grade]") - useradd = input() - if useradd == "subject": + user_add = input() + if user_add == "subject": subject = input("Which subject do you want to add? \n") return "input", subject - elif todo == "category": + elif user_add == "category": subject = input("To which subject do you want to add the category? \n") category = input("Which category do you want to add? \n") rating = float(input("Rating? \n")) return "input", subject, category, rating - elif todo == "grade": + elif user_add == "grade": 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") grade = input("Grade? \n") - gradename = input("What's the name of the grade? \n") - return "input", subject, category, grade, gradename - + grade_name = input("What's the name of the grade? \n") + return "input", subject, category, grade, grade_name -- 2.39.5 From 93cf2ecfdc9ba8ae8513676c31ee882f4173565f Mon Sep 17 00:00:00 2001 From: lade043 <48773751+lade043@users.noreply.github.com> Date: Tue, 30 Jul 2019 16:55:26 +0200 Subject: [PATCH 4/5] Update user_IO.py --- user_IO.py | 1 - 1 file changed, 1 deletion(-) diff --git a/user_IO.py b/user_IO.py index 7fcc4d1..4fa37a9 100644 --- a/user_IO.py +++ b/user_IO.py @@ -1,5 +1,4 @@ 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") if todo == "see": print("Which subject do you want to know the information?") -- 2.39.5 From 4ae91748d14b8c84fc84048c0952430c29eb4bb1 Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Tue, 30 Jul 2019 17:01:40 +0200 Subject: [PATCH 5/5] edited class subject and grade --- subject.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subject.py b/subject.py index 6e19562..dda4c0d 100644 --- a/subject.py +++ b/subject.py @@ -20,6 +20,17 @@ class Subject: def return_grade_categories(self): return [i for i in self.grades] + def return_average_of_category(self, category): + return sum(self.grades[category][0]) / len(self.grades[category][0]) + + def return_average_of_subject(self): + rating_sum = 0 + grade_sum = 0 + for i in self.grades: + rating_sum += self.grades[i][1] + grade_sum += self.return_average_of_category(i) + return grade_sum / rating_sum + class Grade: def __init__(self, grade, name, date=str(str_date.now())): -- 2.39.5