mardi 30 novembre 2021

Returning output as a matrix with required info

So I have here with me that is a function that calculates an employee's net salary. It includes the basic salary, overtime rate, deduction. It has two inputs ( basic salary and hours of overtime pay ).

def Net_salary(basic,overtime):
    if (basic < 3000):
        deduction = 0.85
        otrate = 20
        netsalary = basic * deduction + (overtime * otrate)
    elif (basic < 5000):
        deduction = 0.79
        otrate = 40
        netsalary = basic * deduction + (overtime * otrate)
    elif (basic < 8000):
        deduction = 0.73
        otrate = 60
        netsalary = basic * deduction + (overtime * otrate)
    else:
        deduction = 0.67
        otrate = 80
        netsalary = basic * deduction + (overtime * otrate)
    return netsalary    

My question is how do I return the info as a 5 by 6 matrix where 1st column is the employee number (1-5), 2nd column is the respective basic salary, 3rd column is the deduction amount (basic * deduction), 4th column is the hours worked overtime, 5th column is overtime pay( otrate * overtime) and 6th column is their net salary

Aucun commentaire:

Enregistrer un commentaire