""" 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 a US representative these numbers are 25 and 7, respectively. Write a program that allows the user to enter their age and years of citizenship as inputs and displays their eligibility for the Senate and the House. Test all the appropriate conditions. """ age = int(input("How old are you?")) us_Citizen = int(input("How many years have you been a U.S. Citizen?")) if age >= 30 and us_Citizen >= 9: result = " You are eligible to be a US representative and a US senator" elif age >= 25 and us_Citizen >= 7: result = " You are eligible to be a US representative. " else: result = " Not eligible to be a US representative or US senator." print result
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question