Python Forum

Full Version: Marks Calculator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi everyone,

So I am trying to figure out what's the mathematical operation I need to apply to get the final mark of three given grades.

The weightings of the assessments are as follows:

Exam
70%
Assignment
20%
Assessable Tutorial
10%

Assessable Tutorial mark (/10) >> 7

Assignment mark (/100) >> 56

Exam mark (/150) >> 93

Final Mark: 62

May someone explain me this exercise?

Kind regards,

Azure
The expected Final mark (points or percent) should be specified in your assignment. Given that max points in each component of the final mark are different (10, 100, 150) it make more sense it to be as percent. But again, it could be points and should be specified in your assignment. In any case you need to find weighted average of each component mark.
I see you changed the final mark to 62 (was ??). So it's a percent (or point out of 100) rounded to int. number
(Apr-24-2020, 07:26 AM)buran Wrote: [ -> ]The expected Final mark (points or percent) should be specified in your assignment. Given that max points in each component of the final mark are different (10, 100, 150) it make more sense it to be as percent. But again, it could be points and should be specified in your assignment. In any case you need to find weighted average of each component mark.

So, it should basically be something like:

Assessable Tutorial 7x0.1=0.7

Assignment 56x0.2=11.2

Exam 93x0.7=65.1

------------------------------------------------------------------------

Final grade: 0.7+11.2+65.1=77

However, the final result I got by doing this operation is different from the one it's supposed I should get Huh

Am I missing something?

Do I need to calculate 7 out 10, 56 out 100 and 93 out to 150 too?

P.S: Yes, I made a mistake before, I forgot to type the final mark, Buran.
77 is meaningless as number, because you basically sum apples and pears - as I noted the components have different max points - 10, 100, 150.

so, you need to calculate each component as percent of maximum points for that component.
0.1*0.7 + 0.2*0.56 + 0.7*0.62 = 0.616 or 61.6% rounded up to 62 out of 100

with 77 you can get close too - max points you can get is 0.1*10+0.2*100+0.7*150 = 126, so you have 77/126 ~ 0.611111111 or 61.1% ~ 61 out 100. But that is just approximation, the correct calculation is to work with percents as above
(Apr-24-2020, 08:19 AM)buran Wrote: [ -> ]77 is meaningless as number, because you basically sum apples and pears - as I noted the components have different max points - 10, 100, 150.

so, you need to calculate each component as percent of maximum points for that component.
0.1*0.7 + 0.2*0.56 + 0.7*0.62 = 0.616 or 61.6% rounded up to 62 out of 100

with 77 you can get close too - max points you can get is 0.1*10+0.2*100+0.7*150 = 126, so you have 77/126 ~ 0.611111111 or 61.1% ~ 61 out 100. But that is just approximation, the correct calculation is to work with percents as above

I got it!

Thank you so much, Buran!

I got another question for you. Sorry, I am still a newbie in Python.

So, I need to code that formula in Python now. This is my try, does it make sense?

While True:

print(“Welcome to the Marks Calculator! “)
studentID = int(input(“Enter Student ID >> “))
print(“Enter Student ID >> “ + studentID”)
atMark = int(input(“Enter Assessable Tutorial mark (/10) >> “))
print(“Enter Assessable Tutorial mark (/10) >> “ + atMark”)
asMark = int(input(“Enter Assignment mark (/100) >> “))
print(“Enter Assignment mark (/100) >> “ + asMark)
exMark = int(input(“Enter Exam mark (/150) >> “))
print((“Enter Exam mark (/150) >> “ + exMark)
exam = 0.7
assignment = 0.2
tutorial = 0.1

finalGrade = float(tutorial*10+assignment*100+exam*150)/ atMark*tutorial+asMark*assigment+exMark*exam)

print(“Student ID: “ + studentID, “Final Mark: “ + finalGrade)
proceed = input(“Would you like to process another student’s marks? (y/n) >> ”)


if proceed.upper() != “Y”:
print(You have processed the following students: “)


-----------------------------
I don’t know how to create a column with the StudentID and the FinalMark in this part….


print(“Program has terminated, goodbye!”)
break;
finalGrade = (56*20/100)+(93*70/150)+7 
print(“Student ID: “ + studentID, “Final Mark: “ + str(finalGrade))
(Apr-24-2020, 10:49 AM)anbu23 Wrote: [ -> ]
finalGrade = (56*20/100)+(93*70/150)+7 
print(“Student ID: “ + studentID, “Final Mark: “ + str(finalGrade))

Thank you so much for your help anbu23!

Kind regards,

Azure
Hi everyone,

I am trying to store different values in a variable to print out them after the program ends up, showing their studentID and their final grade, however, it seems that my code is not working.
May someone explain to me how to store two values in an array by using for?

Here is an example of my code:

items = {}
while True:

    print("Welcome to the Marks Calculator! ")

    studentID = int(input("Enter Student ID >> "))
    atMark = float(input("Enter Assessable Tutorial mark (/10) >> "))
    asMark = float(input("Enter Assignment mark (/100) >> "))
    exMark = float(input("Enter Exam mark (/150) >> "))

    finalGrade = int(asMark*20/100)+(exMark*70/150)+atMark
    items.update( {studentID: finalGrade} )

    proceed = input("Would you like to process another student’s marks?(Y/N)>> ")

    if proceed.upper() != "Y":

        for studentID, finalGrade in items.items():
            print(studentID, finalGrade)

        print("Program has terminated, goodbye!")

        break;
Kind regards,

Azure
items = []
.....
    finalGrade = int(asMark*20/100)+(exMark*70/150)+atMark
    items.append( [studentID, finalGrade] )
Pages: 1 2