I cannot figure this out… Here is there question from my homework assignment:

Write a Python function for computing an employee’s pay based on the following description.

The employee’s weekly pay is based on her category, which can be one of these two: Category 1: Salary Category 2: Hourly

For the hourly category, there are two subcategories, regular hours & overtime: Regular hours are when the employee works 40 or less hours, and they have their own regular rate. Overtime hours are any hours that the employee works beyond 40. They have an overtime rate. For example, if an hourly employee works 44 hours, then the first 40 hours are paid based on the regular hour rate and the remaining 4 hours are paid based on the overtime hour rate.

Write a function that takes as input the category, which can only be “salary” or “hourly”, and the number of worked hours, and it prints out the employee pay. Use these variables inside your function:

hourlyRate = 15

overtimeRate= 20

salaryRate = 500

Test your code using these two cases:

Case 1:

category = “salary”


category = “hourly” and hours = 44

That is, run case 1, by setting category = “salary” and then print the ‘total pay’, which is basically the salary. Then run the program again for case 2. For this case consider the hourly rate for the first 40 hours, and then consider the overtime rate for the remaining 4 hours.

Here is my Python code that I wrote that I'm sure isn't correct and keeps giving me syntax errors:

salaryRate = 500
hourlyRate = 15
overTimeRate = 20
weeklyPay = 0

category = input(“Is the employee hourly or salary?”)

if category == hourly:
hours = int(input(“How many hours were worked?”)
if hours >= 40:
weeklyPay = 40*hourlyRate
weeklyPay = 40*hourlyRate + (hours – 40)*20

category = salary:
weeklyPay = salaryRate

… Please help, I've been stuck on this for over 6 hours.

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now