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.


Expert's answer

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')
LATEST TUTORIALS
APPROVED BY CLIENTS