I am getting this error
PYTHON - TypeError: unsupported operand type(s)

weekPay = []
names = []
hours = []
wages = []

while True:
    name = raw_input("Please input yor first and last name or type \"Done\" to continue: ")
    if name.title() == "Done":
        break
    names.append(name.title())
    hour = raw_input("Please input amount of hours worked this week 1 to 60: ")
if hour >= 1 or hour <= 60:
    hours.append(int(hour))
else:
    print "Invalid amount of hours."
wage = float(raw_input("Please input your hourly wage between 6.00 - 20.00: "))
if wage < 6.00 or wage > 20.00:
    print "Invalid hourly wage."
else:
    wages.append(float(wage))

class Employee(object):
    def __init__(self, names = [], hours = [], wages = []):
        self.names = names
        self.hours = hours
        self.wages = wages

def Names(self):
    return self.names
def Hours(self):
    return self.hours
def Wages(self):
    return self.wages
empNames) = property(Names)
empHours) = property(Hours)
empWages) = property(Wages)

def getPay(self):
    return self.__payment__
def setPay(self, money = 0):
    self.__payment__ = money
    payment = property(getPay, setPay)
def employeePay(self, money = 0, hours = 0, wages = 0):
    self.payment = money
for hour in hours:
    if hour >= 1 and hour <= 40:
        self.payment = empWages * empHours
        weekPay.append(self.payment)
    if hour >= 41 and hour <= 60:
        self.payment = (empHours - 40)*(empWages * 1.5) + (empWages * 40)
        
        weekPay.append(self.payment)
        employeeObj = Employee(names , hours, wages)

print "Employees: ", employeeObj.empNames
print "Hours worked: ", employeeObj.empHours
print "Hour Wage: ", employeeObj.empWages

print "Weekly Pays: ", weekPay
employeeObj.employeePay(hours, wages)

Recommended Answers

All 3 Replies

Your indention is in unsupported format ;) CODE tags, please.

This kind of condition for example is allways True:
if hour >= 1 or hour <= 60:

unlike for example this
if 1 <= hour <= 60:

weekPay = []
names = []
hours = []
wages = []

while True:
    name = raw_input("Please input yor first and last name or type \"Done\" to continue: ")
    if name.title() == "Done":
        break
    names.append(name.title())
    hour = raw_input("Please input amount of hours worked this week 1 to 60: ")
if hour >= 1 or hour <= 60:
    hours.append(int(hour))
else:
    print "Invalid amount of hours."
wage = float(raw_input("Please input your hourly wage between 6.00 - 20.00: "))
if wage < 6.00 or wage > 20.00:
    print "Invalid hourly wage."
else:
    wages.append(float(wage))

class Employee(object):
    def __init__(self, names = [], hours = [], wages = []):
        self.names = names
        self.hours = hours
        self.wages = wages

def Names(self):
    return self.names
def Hours(self):
    return self.hours
def Wages(self):
    return self.wages
empNames) = property(Names)
empHours) = property(Hours)
empWages) = property(Wages)

def getPay(self):
    return self.__payment__
def setPay(self, money = 0):
    self.__payment__ = money
    payment = property(getPay, setPay)
def employeePay(self, money = 0, hours = 0, wages = 0):
    self.payment = money
for hour in hours:
    if hour >= 1 and hour <= 40:
        self.payment = empWages * empHours
        weekPay.append(self.payment)
    if hour >= 41 and hour <= 60:
        self.payment = (empHours - 40)*(empWages * 1.5) + (empWages * 40)
        
        weekPay.append(self.payment)
        employeeObj = Employee(names , hours, wages)

print "Employees: ", employeeObj.empNames
print "Hours worked: ", employeeObj.empHours
print "Hour Wage: ", employeeObj.empWages

print "Weekly Pays: ", weekPay
employeeObj.employeePay(hours, wages)

You need to indent the statement blocks that belong to the class properly.

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.