0

I keep getting a error for adding strings and integers together. how can I fix this? It is in the line hours.append(hWork + "\n")

hours=[]
hWork="1"
while True:
    employee=raw_input("\nPlease enter the employees' first and last name. ")
    hWork=int(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:
            hours.append(hWork + "\n")
            empDone = ""
            empDone = raw_input("Type DONE when finished with employees' information. ")
            if empDone == "DONE":
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by pyTony
0

this is the error i am getting.

Traceback (most recent call last):
File "C:/Users/Office/Desktop/py.py", line 32, in <module>
hours.append(hWork + "\n")
TypeError: unsupported operand type(s) for +: 'int' and 'str'

0

'\n' is not number like error says. Also work times do not contain newlines.

Edited by pyTony: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.