Exerciseschevron_rightChapter 22chevron_right22.3
fitness_center

Exercise 22.3

Weight the Rubric for a Real Employer

Level 2
Chapter 22: Career Next Steps
descriptionProblem

The rubric weights (real_data and states_decision at 25 each) reflect what most reviewers value. Pick a specific kind of employer (a service company, an operator's subsurface team, a software vendor) and re-weight the rubric for what they would actually prioritise. Re-score the same project under both weightings. Does the project that looks "hireable" to one look that way to the other, and what does that tell you about tailoring a portfolio?

---

The default rubric reflects what most reviewers value. A specific employer weights things differently -- a software vendor cares far more about tests and reproducibility than about a real dataset. This exercise shows that the same project can be "hireable" to one and not the other, which is the whole argument for tailoring a portfolio.

Write one function and define one custom rubric:

def score_project(project, rubric):
    """Return {'score': sum of met weights, 'hireable': score >= 80}."""

Exact procedure: score = sum(rubric[k] for k in rubric if project.get(k)); hireable = score >= 80. Define VENDOR -- a software-vendor rubric that weights has_tests and reproducible at 30 each, states_decision and has_readme at 15 each, and real_data at 10 (it sums to 100). At module level, score the provided PROJECT under both DEFAULT and VENDOR.

Expose: score_project, VENDOR, default_result = score_project(PROJECT, DEFAULT), vendor_result = score_project(PROJECT, VENDOR).

> Think about it: the provided project clears the default bar but not the > vendor's. Nothing about the project changed -- only who is reading it. What does > that tell you about sending the same repo to every employer?

lightbulbHints (0/3)

Stuck? Reveal hints one at a time — they progress from nudge to near-solution.

codeYour solution
main.py
visibilityReveal reference solutionexpand_more

Try solving it yourself first — the hints walk you through it. The solution below is one valid approach; yours may differ and still be correct.


# ── The default reviewer rubric and the project under review (do not edit) ──
DEFAULT = {
    "real_data": 25, "states_decision": 25, "reproducible": 20, "has_readme": 15, "has_tests": 15,
}
PROJECT = {"real_data": True, "states_decision": True, "reproducible": True,
           "has_readme": True, "has_tests": False}
# ── end do-not-edit ───────────────────────────────────────────


def score_project(project, rubric):
    """Sum the weights of the criteria met; hireable at >= 80."""
    score = sum(rubric[k] for k in rubric if project.get(k))
    return {"score": score, "hireable": score >= 80}


# A software vendor values tests and reproducibility over a real dataset.
VENDOR = {
    "real_data": 10, "states_decision": 15, "reproducible": 30, "has_readme": 15, "has_tests": 30,
}

default_result = score_project(PROJECT, DEFAULT)
vendor_result = score_project(PROJECT, VENDOR)
print("under DEFAULT:", default_result)
print("under VENDOR :", vendor_result)

lockCopying code is a Full Access feature.