Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Marks Calculator
#1
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
Reply
#2
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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
I see you changed the final mark to 62 (was ??). So it's a percent (or point out of 100) rounded to int. number
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
(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.
Reply
#5
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#6
(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;
Reply
#7
finalGrade = (56*20/100)+(93*70/150)+7 
print(“Student ID: “ + studentID, “Final Mark: “ + str(finalGrade))
Reply
#8
(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
Reply
#9
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
Reply
#10
items = []
.....
    finalGrade = int(asMark*20/100)+(exMark*70/150)+atMark
    items.append( [studentID, finalGrade] )
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020