0 out of 68 challenges solved

Check voting eligibility based on the given age

Question:
Write a function called check_voting_eligibility that takes a person's age as input and returns a string indicating whether the person is eligible to vote or not. Use conditional statements (if-else) to perform the eligibility check.

Consider the following criteria:

  • If the age is 18 or above, the person is eligible to vote.
  • If the age is below 18, the person is not eligible to vote.

Example:
Input: 20
Output: "Eligible to vote"

def check_voting_eligibility(age):
    """
    Checks the voting eligibility based on the given age.

    Args:
    age (int): The person's age.

    Returns:
    str: A string indicating the voting eligibility.
    """
    # TODO: Implement the check_voting_eligibility function
    pass
Related challenges