Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import csv from operator import itemgetter INDUSTRIES = ['Agriculture', 'Business services', 'Construction', 'Leisure/hospitality', 'Manufacturing'] def read_file(fp): '''Docstring''' pass def get_totals(L): '''Docstring''' pass def get_industry_counts(L): '''Docstring'''

image text in transcribedimage text in transcribed

import csv from operator import itemgetter INDUSTRIES = ['Agriculture', 'Business services', 'Construction', 'Leisure/hospitality', 'Manufacturing'] def read_file(fp): '''Docstring''' pass def get_totals(L): '''Docstring''' pass def get_industry_counts(L): '''Docstring''' pass def get_largest_states(L): '''Docstring''' pass def main(): fp = open("immigration.csv") L = read_file(fp) us_pop,total_pop = get_totals(L) print(" Data on Illegal Immigration ") print("Summative:", us_pop) print("Total :", total_pop) states = get_largest_states(L) print(" States with large immigrant populations") for state in states: state = state.replace(' ',' ') print(state) counters = get_industry_counts(L) print(" Industries with largest immigrant populations by state") print("{:24s} {:10s}".format("industry","count")) for tup in counters: print("{:24s} {:2d}".format(tup[0],tup[1])) if __name__ == "__main__": main()

image text in transcribedimage text in transcribed

Maryla 275,000 28 Massachuse 250,000 100,000 95,000 20,000 60,000 8.50% 60,000 6.40n Construction Construction Service 5.10% Business ser Constructiol Service Farming 1.40% Manufacturi Agriculture Service Farming 2.20 Manufacturi Agriculture Src Farming 1.00% Constructio Constructio! Constructio! Construction 1.50% Leisure/hos Mining aming 29 Michigan 30 Minnesota 31 Mississippi 2.20% 29% 0.70% 21% Not sig issouri vice Construction 33 Montana

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started