Answer to Question #221365 in Python for Dion Martins

Question #221365

Write a program that determines whether you can run for president. To run for president the constitution states: No Person except a natural born Citizen, or a Citizen of the South Africa(SA), at the time of the Adoption of this Constitution, shall be eligible to the Office of President; neither shall any Person be eligible to that Office who shall not have attained to the Age of thirty five Years, and been fourteen Years a Resident within the South Africa. Ask three questions of the user and use the guess and check pattern to determine if they are eligible to run for President.


1
Expert's answer
2021-07-29T23:31:40-0400
question1 = input('Are you a south African citizen: ')
question2 = int(input('How old are you: '))
question3 = int(input('How long have you stayed in the country: '))
if question1 == 'Yes' and question2 >= 35 and question3 >=14: 
  print('You are eligible')
else:
  print('You are not qualified')

Are you a south African citizen: Yes
How old are you: 30
How long have you stayed in the country: 18
You are not qualified

Are you a south African citizen: Yes
How old are you: 36
How long have you stayed in the country: 15
You are eligible

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS