Write a payroll program that pays time and a half for anything over 40 hours. This should have 3 functions in addition to main
The first function asks the user how many total hours were worked and the pay rate and returns this information to main. These values must be validated. Hours worked must be at least 8 and no more than 86. Pay rate cannot be less than $7.00 or more than $50.00.
The second function calculates the regular hours and overtime hours and returns this information to main. A person might work less than 40 hours so you must allow for that situation.
The third function calculates the regular pay, (regular hours times pay rate); overtime pay, (overtime hours times overtime pay rate) and the total pay and returns this information to mainMain will then display this information on the screen like the sample below. (Values will have to be passed and returned).
The output should look something like the following:

Payroll Information
            Pay rate                     $10.00
            Regular Hours                40
            Overtime hours               20
            Regular pay                  $400.00
            Overtime pay                 $300.00
            Total Pay                    $700.00

Good luck, return with your code if you get stuck.

Nice homework, what have you done so far?

Just to make what pyTony and Vegaseat said perfectly clear: we won't do your homework for you. To quote the DaniWeb Community Rules:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

We are here to help you become a competent programmer, not to hand you an underserved passing grade. Show us what you've done so far, and we'll help you fix it. Ask questions, we'll try to answer them. But just posting the your assignment without so much as an introduction? That's not going to earn anything but our contempt.

def main():
     hours=0.0
     payrate=0.0
     regularhours=0.0
     overtimehours=0.0
     totalhours=0.0
     payrate,hours=totalhours
     regulaerhours,overtimehours=calchour

def hours():

           hours = float(input("How many hours did you work?: "))
           while hours >8 and hours >86:
                 hours=input("invalid speed. please enter a number atleast from 8 and and above 50")
                 payrate=float(input("enter the pay rate"))
           while payrate<=7 and payrate>50:
                 payrate= input("invalid speed.please enter a number between 7 and 500")
           return (payrate,hours)

def calchour(regularhours,overtimehours):

           if hours > 40:
              regularhours = 40
              overtimehours = hours - 40
           else:
              regularhours = hours
              overtimehours = 0
           return (regulaerhours,overtimehours)


def prt(payrate,regularhours,overtimehours,regularpay,overtimepay,totalpay):
              Regularpay=regularhours*payrate
              overtimepay=overtimehours*(payrate*1.5)
              totalpay=regularpay+overtimepay
              print ("Pay rate $%0.2f" %  payrate)
              print ("Regular Hours %d" % regularhours)
              print( "Overtime hours %d" % overtimehours)
              print ("Regular pay $%0.2f" % (regularhours * payrate))
              print ("Overtime pay $%0.2f" % (overtimehours * (payrate * 1.5)))
              print ("Total Pay $%0.2f" % (regularhours * payrate + overtimehours * payrate * 1.5))

main()


is my program. getting error line 7 in main
    payrate,hrs=totalhours and line40  in module main()

    could you please suggest me.

There are many things to change in your code. Solve the issues one by one with the help of the exception tracebacks printed by python. Here tre traceback is

Traceback (most recent call last):
  File "./payrate.py", line 42, in <module>
    main()
  File "./payrate.py", line 7, in main
    payrate,hours=totalhours
TypeError: 'float' object is not iterable

totalhours was defined to be 0.0 at line 6, so line 7 is equivalent to

payrate, hours = 0.0

which is meaningless. You probably meant to call function hours() here. But you must first choose another name for the local variable hours defined at line 2, or change the name of the function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.