Many companies pay time-and-a-half for any houred worked above 40 hours in a given week . write a python program to input the number of hours worked and hourly rate. calculate the total wages of the week.

 Many companies pay time-and-a-half for any houred worked above 40 hours in a given week . write a program to input the number of hours worked and hourly rate. calculate the total wages of the week.


hours_worked = float(input("Enter the number of hours worked in a week: "))
hourly_rate = float(input("Enter the hourly rate: "))

regular_hours = 40

overtime_rate = 1.5

if hours_worked <= regular_hours:
   
    total_wages = hours_worked * hourly_rate
else:
 
    overtime_hours = hours_worked - regular_hours
   
    total_wages = (regular_hours * hourly_rate) + (overtime_hours * hourly_rate * overtime_rate)

print(f"Total wages for the week: ₹{total_wages:.2f}")

Comments