Problem 158829 · easy · Level 01 Prerequisites & Setup

Voter Eligibility

conditionals · boolean logic

Someone may vote only if they are at least 18 years old, are a citizen, and are registered. Write can_vote(age, is_citizen, is_registered) that returns True when all three requirements hold and False otherwise.

Examples

Input:  age = 18, is_citizen = True, is_registered = True
Output: True

Input:  age = 17, is_citizen = True, is_registered = True
Output: False

Input:  age = 40, is_citizen = False, is_registered = True
Output: False

Constraints

  • 0 <= age <= 130
  • is_citizen and is_registered are booleans

Goals

  • Combine three requirements with and
  • Return the comparison result directly instead of if True return True
Starting Python…