Here is my code (btw I am new to Stackoverflow and coding in general so forgive me if I made some mistakes in formatting this question):
hours = int(input('Enter hours:'))
rate = int(input('Enter rate:'))
pay =('Your pay this month' + str((hours + hours/2) * rate))
def computepay(hours,rate):
pay =('Your pay this month' + str((hours + hours/2) * rate))
return pay
print(pay)
To take into account overtime versus regular rates of pay it seems like you will need to know how much time the employee worked in each category. With that in mind, here is a simplified example to illustrate some of the key concepts.
Example:
def computepay(hours, rate):
return hours * rate
regular_rate = float(input("Hourly rate in dollars: "))
regular_hours = float(input("Regular hours worked: "))
overtime_hours = float(input("Overtime hours worked: "))
regular_pay = computepay(regular_hours, regular_rate)
overtime_pay = computepay(overtime_hours, regular_rate * 1.5)
total_pay = regular_pay + overtime_pay
print(f"This pay period you earned: ${total_pay:.2f}")
Output:
Hourly rate in dollars: 15.00
Regular hours worked: 40
Overtime hours worked: 10
This pay period you earned: $825.00