209k views
4 votes
Write a function called PayLevel that returns a level given an Ssn as input. The level are: "Above Average" if the employee makes more than the average for their department "Average" if the employee makes the average for their department "Below Average" if the employee makes less than the average for their department

User Bdoshi
by
5.6k points

1 Answer

3 votes

Answer:

Step-by-step explanation:

Since no further information was provided I created the PayLevel function as requested. It takes the Ssn as input and checks it with a premade dictionary of Ssn numbers with their according salaries. Then it checks that salary against the average of all the salaries and prints out whether it is Above, Below, or Average. The output can be seen in the attached picture below.

employeeDict = {162564298: 40000, 131485785: 120000, 161524444: 65000, 333221845: 48000}

average = 68250

def PayLevel(Ssn):

pay = employeeDict[Ssn]

print("Employee " + str(Ssn) + " is:", end=" "),

if pay > average:

print("Above Average")

elif pay < average:

print("Below Average")

else:

print("Average")

PayLevel(161524444)

PayLevel(131485785)

Write a function called PayLevel that returns a level given an Ssn as input. The level-example-1
User Mishael
by
6.7k points