Answer to Question #225178 in Python for Dion Martins

Question #225178

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-08-11T06:26:47-0400
questions = (
	'Are You Citizen of the South Africa? y/n ',
	'Are you over 35 years old? y/n ',
	'Have You been fourteen Years a Resident within the South Africa? y/n ')
k = 0
answ = 0
while k < len(questions):
	key = input(questions[k])
	if key.lower() == 'y':
		answ += 1
	elif key.lower() == 'n':
		pass
	else:
		continue
	k += 1
if answ >= 3:
	print('You can run for President of South Africa')
else:
	print('You cannot run for President of South Africa')

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
New on Blog
APPROVED BY CLIENTS