Start learning free

LESSON 171 OF 410 · PROJECTS: EVERYDAY PROGRAMS

Report Card V2 - Weighted Score in Python

Practice

Combine variables and arithmetic to compute a student's weighted final score.

Weights: Homework 20%, Midterm 30%, Final 50%. Each weighted part is rounded down to a whole number before the parts are added.

You start with:

homework = 90
midterm = 82
final = 88

Build:

Score: 86

Rules:

  • Compute score = homework * 20 // 100 + midterm * 30 // 100 + final * 50 // 100.
  • Each part is rounded down by //.
  • For the starting data: 18 + 24 + 44 = 86.
  • Store the result in a variable named score. The checker prints "Score: " followed by its value for you, so do not print anything yourself.

Use // after each multiplication: homework * 20 // 100 + midterm * 30 // 100 + final * 50 // 100.

homework = 90
midterm = 82
final = 88

score = homework * 20 // 100 + midterm * 30 // 100 + final * 50 // 100

STEP 1 OF 1
    Ctrl + Enter to check

    Report Card V2 in Python

    Keep going with PythonAbout 340 step-by-step lessons, from your first line of code to coding interviews. Free to start.
    Start learning free