62.1k views
3 votes
calculateAverageSalary(filename): Returns the average salary of all employees rounded down to 2 decimal points highestHireMonth(filename): Returns the month (integer) during which most hires were made over the years getMonth(date): Helper function to extract and return the month number from a date given as a string input of format MM/DD/YY. Return type should be an int.

User Evilive
by
4.7k points

1 Answer

3 votes

Answer:

An extract from the answer is as follows:

for i in salary:

total_salary+=float(i)

count+=1

return round(total_salary/count,2)

def getMonth(date):

ddate = []

for i in date:

ddate.append(i.split('/')[0])

mode = int(max(set(ddate), key=ddate.count))

return mode

def highestHireMonth(filename):

month = []

See explanation for further details

Step-by-step explanation:

Given

Attachment 1 completes the question

The complete answer could not be submitted. So, I've added it as an attachment.

See attachment 2 for program source file which includes the main method.

Comments are used to explain difficult lines

calculateAverageSalary(filename): Returns the average salary of all employees rounded-example-1
User Mohammad Kermani
by
4.7k points