Practice · Python

Practice Comparison Operators

Compare values with == != < <= > >= and membership/identity, and recognize that comparisons produce bool values.

Comparison Operatorswarming python…

Sport Score Comparisons

Write a function evaluate_sport(points, sport) that receives an integer points earned by a player and a string sport naming the sport. The function should return a tuple of three booleans:

  1. points > 5
  2. sport == "soccer"
  3. "ball" in sport

For example:

evaluate_sport(10, "soccer")  # (True, True, False)
evaluate_sport(3, "basketball")  # (False, False, True)
Press Run to see output, or Check to grade against the tests.

Want a whole course built around comparison operators?

Start my path — free

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