Suppose the weekly hours for all employees are stored in a table. Each records an employee’s seven-day work hours with seven columns (see the example given below). Write a function that displays employees and their average daily hours in decreasing order of the average hours.
display_average_hours(weekly_hours_table: list):
An example input and output is given below:
Input:
[
[8, 7, 8, 8, 6, 7, 9],
[7, 7, 7, 8, 8, 8, 7],
[6, 6, 6, 6, 6, 6, 6],
[9, 9, 9, 9, 9, 9, 9],
[5, 5, 5, 5, 5, 5, 5],
[8, 7, 8, 8, 7, 8, 7],
[7, 8, 7, 8, 7, 8, 7],
[6, 6, 6, 6, 6, 6, 6]
]
Output:
Employee, Average Daily Hours
-----------------------------
Employee 4 9.00 hours
Employee 1 7.57 hours
Employee 6 7.57 hours
Employee 2 7.43 hours
Employee 7 7.43 hours
Employee 3 6.00 hours
Employee 8 6.00 hours
Employee 5 5.00 hours