Who can be president?
The U.S. Constitution lists three qualifications for the presidency:
- The person must be at least 35 years old.
- The person must be a natural-born citizen1 of the United States.
- The person must have been a resident in the United States for at least 14 years.
In Listing 1, the main function receives a person’s age, citizenship status, and years of residency as parameters. It calls check_eligibility and prints a message based on the Boolean value returned by that function.
is_citizen parameter is True when the person was a U.S. citizen from birth and False otherwise.
In Listing 2, we have several implementations of check_eligibility. Each function should return True only when all three requirements are met and False otherwise.
check_eligibility for determining whether a person is eligible to become president (Question 1).
Which pair of implementations of check_eligibility correctly determines whether a person is eligible to become president based on their age, citizenship status, and years of residency?
Footnotes
The citizenship requirement concerns when a person became a U.S. citizen. For example, Elon Musk, a South African-born entrepreneur, and Arnold Schwarzenegger, an Austrian-born actor and politician, are both naturalized citizens, so they are not eligible to become president.↩︎