Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function, called congress(). that takes two formal parameters: a person\

ID: 3937696 • Letter: W

Question

Write a function, called congress(). that takes two formal parameters: a person's age (int) and years of citizenship (int) as input and returns their eligibility for the Senate and House. The return value of the function is one of the following three: (1) Eligible for the Senate and the House.' (2) "Eligible only for the House." or (3) "Not eligible for Congress." The caller of the function congress() in the test() function then prints a message using the format shown in the next problem. You must use if-elfin-else statements in your solution. Your congress() function must not print anything. Do not import external module in your solution. Write a test function, called test(), to test the congress() function with the following actual parameters and write a message accordingly: Call test() in your program and show the result Examples of the correct output format include: Age 45 with 17 years of citizenship: Eligible for the Senate and the House Age 18 with 18 years of citizenship: Not eligible for Congress

Explanation / Answer

2.1 :

def congress(age,citi):

if age>=30&&citi>=15:

return "eligible for senate and house"

elif !age>=30 && citi>=15:

return "eligible only for the house"

else:

return " not eligible for congress"

2.2 :

def test():

print congress(65,25)

print congress(35,8)

print congress(35,5)

print congress(28,8)

print congress(24,5)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote