class operations:
def individualCategoryCalculator(testPoints, testOutOf, categoryPoints, categoryOutOf):
return ((categoryPoints + testPoints) / (categoryOutOf + testOutOf)) * 100
def totalClassGrade():
grades = []
categoryWeight = []
finalGrade = 0
working = True
while working:
answer = input("What should I do? ")
trueAnswer = answer.lower()
if (trueAnswer == "add"):
x = float(input("What is the grade? "))
grades.append(x)
x = float(input("What is the category weight? ")) / 100
categoryWeight.append(x)
if (trueAnswer == "print"):
print(grades)
print(categoryWeight)
if (trueAnswer == "total"):
for x in range(0, len(grades)):
finalGrade = finalGrade + (grades[x] * categoryWeight[x])
print(finalGrade)
working = False
working = True
while working:
answer = input("What would you like to do? ")
trueAnswer = answer.lower()
if (trueAnswer == "individual"):
x = str(operations.individualCategoryCalculator(int(input("What did you get on the test? ")), int(input("Out of What? ")), int(input("How many points do you have in the category? ")), int(input("How many total points in category? "))))
print("The Category grade is now %s" %(x))
if (trueAnswer == "total"):
operations.totalClassGrade()
if (trueAnswer == "end"):
working = False
To embed this program on your website, copy the following code and paste it into your website's HTML: