Question & Answer: A person is eligible to be a US senator if they are at least 30 years old and have been a US citizen for at least 9 y…..

A person is eligible to be a US senator if they are at least 30 years old and have been a US citizen for at least 9 years. To be US representative these numbers are 27 and 7, respectively. Write a pseudocode for a program that accepts a person’s age and years of citizenship as Input and outputs their eligibility for the senate and the house. After the code write the program

Expert Answer

 

def congress( person_age, years_of_citizenship ):
eligible_for_us_senator = False;
eligible_for_us_representative = False;

if( person_age >= 25 and years_of_citizenship >= 7):
eligible_for_us_representative = True;
if( person_age >= 30 and years_of_citizenship >= 9):
eligible_for_us_senator = True;

if( eligible_for_us_senator and eligible_for_us_representative ):
return “Eligible for the Senate and the House”;
elif( eligible_for_us_representative ):
return “Eligible only for the House”;
else:
#if not eligible_for_us_representative, then also not eligible_for_us_senator
return “Not eligible for Congress”;

Still stressed from student homework?
Get quality assistance from academic writers!