""" A soccer team is looking for females from ages 14 to 18 to play on their team. Write a program to ask the user's age and whether the user is male or female (using "m" or "f"). Display a message indicating whether the person is eligible to play on the team. Make the program so that it doesn't ask for the age unless the user is female. You should also handle the condition where a user does not enter "m" or "f" for the gender input. After you have completed this program, test the following cases: Test - gender: male, age: any Test - gender: female, age: 11 What other test cases are needed? """ gender = int(input("Are you a female or a male?")) if gender == "f": age = int(input("How old are you?")) if age >= 14 and age <= 18: result = " You are eligible to play on this soccer team." else: result = " You are not eligible to play on this soccer team." else: result = " You are not eligible to play on this soccer team." 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