USING PYTHON -Based on the representative Excel CSV file below (jobs.csv) write
ID: 3917007 • Letter: U
Question
USING PYTHON
-Based on the representative Excel CSV file below (jobs.csv) write a program that will print out the average yearly salary and the average number of years of experience.
Data Column Information:
-column 1: job title
-column 2: company
-column 3: yearly pay
-column 4: years of experience
-Thank you in advance for your assistance-
Represents Excel CSV File Python Developer Bank of America 121454 10 Senior Python Developer Idle Games 136699 12 Python Developer Google 80000 5 Python Hourly Contractor Bank of America 106000 10 Jr Python Developer US Postal Service 50000 2 Python Developer Secure Computing 75000 4 Python Developer Zimbio 45000 1Explanation / Answer
total_salary = 0 total_years = 0 count = 0 with open('jobs.csv', 'r') as f: for line in f: words = line.strip().split(",") total_salary += float(words[2].strip()) total_years += float(words[3].strip()) print('Average yearly salary is %f ' % (total_salary / count)) print('Average number of years of experience is %f ' % (total_years / count))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.