Skip to content
Snippets Groups Projects
Commit 2f2df7b7 authored by Sven Graupner's avatar Sven Graupner
Browse files

update income_tax_analysis.py

parent c4e27953
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,8 @@ Code for Assignment B: Explore Python
- Challenge 4: Income Analysis
- Challenge 5: Code Income Analysis
Based on 2020 tax returns, income distribution in Madera County, CA, ZIP 93636 was:
Based on 2020 tax returns, income distribution in Madera County, CA
with (postal) ZIP code 93636 was:
#
income brackets: number of tax returns
filed in brackets:
......@@ -13,14 +14,6 @@ income brackets: number of tax returns
[$75,000 to under $100,000] 830
[$100,000 to under $200,000] 1,660
[$200,000 or more, up to $10M>] 550
Find more income distributions:
[93636](https://simplemaps.com/us-zips/93636) (Madera County, CA),
[94040](https://simplemaps.com/us-zips/94040) (Mountain View, CA),
[94304](https://simplemaps.com/us-zips/94304) (Palo Alto, CA),
[94027](https://simplemaps.com/us-zips/94027) (Atherton, CA),
[50860](https://simplemaps.com/us-zips/50860) (Redding, IA) and
[10023](https://simplemaps.com/us-zips/10023) (New York City, NY U West). (1 Pt)
'''
# design a data structure that stores information about a ZIP area
......@@ -35,18 +28,17 @@ zip_10023 = None
# implement a function that calculates the mean income for a ZIP area
def mean_income(_zip) -> int:
return 25000 # mock result, replace with correct result
return 25000 # mock result, replace with computed result
# implement a function that calculates the median income for a ZIP area
def median_income(_zip) -> int:
return 18500 # mock result, replace with correct result
return 18500 # mock result, replace with computed result
# use function that prints analysis results for a ZIP area
# use this function to print results for a ZIP area
def print_analysis(_zip):
_county = 'Madera, CA'
# -> "mean_income in Redding, IA is: 33,333 - median_income is: 31,249"
print(
f'mean_income in {_county:26} is: {mean_income(_zip):10,} - ' +
f'median_income is: {median_income(_zip):8,}'
......@@ -60,7 +52,6 @@ try:
mean_income, median_income, print_analysis = mod.mean_income, mod.median_income, mod.print_analysis
zip_93636, zip_94040, zip_94304, zip_94027, zip_50860, zip_10023 = \
mod.zip_93636, mod.zip_94040, mod.zip_94304, mod.zip_94027, mod.zip_50860, mod.zip_10023
print(f'solution module found: {solution_module}.py')
#
except ImportError:
pass
......@@ -68,7 +59,7 @@ except ImportError:
if __name__ == '__main__':
'''
driver code that runs when this file is directly executed
driver code that runs when file is directly executed
'''
print_analysis(zip_93636)
print_analysis(zip_94040)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment