Good afternoon,
I am currently working on a payroll program for school. I have a question. Here is my code.

#Mainline
def employee():
    global eName
    global pRate
    global hWork

def Lowest(hoursList):
    PAYList.sort()
    lowestPay = hoursList[0]
    return lowestPay

def Highest(hoursList):
    hoursList.sort()
    highestPay=hoursList[len(hoursList)-1]
    return highestPay

def Average(hoursList):
    total=0
    for hour in hoursList:
        total += hour
    avgPay = total / len(hoursList)
    return avgPay


raw_input("Hit ENTER to start Payroll Program.")
hours=[]
hWork="1"
while True:
    eName=raw_input("\nPlease enter the employees' first and last name. ")
    hWork=raw_input("How many hours did they work this week? ")
    if hWork < "1" or hWork > "60":
        print "Employees' can't work less than 1 hour or more than 60 hours!"
        continue
    else:
        pRate=int(raw_input("What is their hourly rate? "))
        if pRate < 6 or pRate > 20:
            print "Employees' wages can't be lower than $6.00 or greater than $20.00!"
        else:
##            eName.append(name.title() + "\n")
            hours.append(hWork + "\n")
            ePass = ""
            ePass = raw_input("Type DONE when finished with employees' information. ")
            if ePass  == "DONE":
                try:
                    hoursFile=open("PAY.txt", "w")
                    hoursFile.writelines(hours)
##                    hoursFile.writelines(eName)
                    hoursFile.close()
                except(IOError):
                    print "Error writing hours! "
                    quit()
                try:
                    hoursFile=open("PAY.txt", "r")
                    hoursList=hoursFile.readlines()
                    hoursFile.close()
                    hoursList.sort()
                except(IOError):
                    print "Error writing names! "
                    quit()
                modHours = hoursList
                for hour in hoursList:
                    print hour
                break

My problem is that I can't get the names to also print in the text document. I also need to have the hours calculated and filed. Any input would be great. Thank you.

I just edited my program some of the stuff wasn't working. But it is working. And I could use help. Thank you.

raw_input("Hit ENTER to start Payroll Program.")
hours=[]
hWork="1"
while True:
    eName=raw_input("\nPlease enter the employees' first and last name. ")
    hWork=raw_input("How many hours did they work this week? ")
    intWork=int(hWork)
    if intWork < 1 or intWork > 60:
        print "Employees' can't work less than 1 hour or more than 60 hours!"
        continue
    else:
        pRate=raw_input("What is their hourly rate? ")
        intRate=int(pRate)
        if intRate < 6 or intRate > 20:
            print "Employees' wages can't be lower than $6.00 or greater than $20.00!"
        else:
            hours.append(hWork + "\n")
            ePass = ""
            ePass = raw_input("Type DONE when finished with employees' information. ")
            if ePass  == "DONE":
                try:
                    hoursFile=open("PAY.txt", "w")
                    hoursFile.writelines(hours)
                    hoursFile.close()
                except(IOError):
                    print "Error writing hours! "
                    quit()
                try:
                    hoursFile=open("PAY.txt", "r")
                    hoursList=hoursFile.readlines()
                    hoursFile.close()
                    hoursList.sort()
                except(IOError):
                    print "Error writing names! "
                    quit()
                modHours = hoursList
                for hour in hoursList:
                    print hour
                break
This article has been dead for over six months. Start a new discussion instead.