Practice · Python

Practice Variables & Assignment

Bind values to names with =, reassign them, and reference variables inside print().

Variables & Assignmentwarming python…

Calculate Basketball Score

Write a function basketball_score(two_pointers, three_pointers) that receives the number of made 2‑point shots and 3‑point shots (they may be integers or strings that represent integers). The function should return a string reporting the total points, formatted exactly as:

Total points: X

where X is the computed total.

Examples

  • basketball_score(3, 2) should return "Total points: 12".
  • basketball_score("4", "1") should return "Total points: 11".
Press Run to see output, or Check to grade against the tests.

Want a whole course built around variables & assignment?

Start my path — free

Adaptive practice, streaks, projects with real code review. Free tier gates AI help, never content.

Practice Python: Variables & Assignment — CodeArcade