Enrollments closing soon for **Post Graduate Certificate Program in Applied Data Science & AI** By **IIT Roorkee** | 3 Seats Left

- Home
- Assessment

37 / 134

Create a function to calculate the payment to be made based on the hours and rate provided.

- Create a function
`pay_calculator`

which will calculate the payment to be made to an employee - The function will take 2 arguments;
`hours`

, and`rate`

, in that order - If the hours are less than or equal to 40, then the payment will be a product of the
`hours`

and`rate`

- If the hours are greater than 40, then till the 40th hour the payment will be calculated as a product of the
`hours`

and`rate`

variables. Beyond the 40th hour, the rate will be 1.5 times that of the original`rate`

variable - The function will finally compute the total pay, save it in a variable named
`total_pay`

and will return the same - Finally, test the function with the following values:
`hours = 45`

, and`rate = 10`

- The output for the above values should be
`475.0`

XP

Taking you to the next exercise in seconds...

Want to create exercises like this yourself? Click here.

Checking Please wait.

Success

Error

Fetching hint, please wait...

Error

Fetching answer, please wait...

Error

**Note - **Having trouble with the assessment engine? Follow the steps listed
here

## Loading comments...