Alina Alina - 1 year ago 59
Python Question

How to solve this `unorderable types` error

I keep getting the following error and my program will not run. I need to make sure my program is modular and have the

statements to figure out what gross pay equation to use.


def main():
hours = input("Enter the number of hours worked: ")
payRate = input("Enter the hourly pay rate: ")

def calcPayWithOT(hours,payRate):
if hours <= BASE_HOURS:
theGrossPayNoOT = hours * payRate
print("The gross pay is $ ", theGrossPayNoOT)
if hours > BASE_HOURS:
theGrossPayOT = (hours - BASE_HOURS) * OT_MULTIPLIER + (hours * payRate)
print("The gross pay is $ ", theGrossPayOT)

Error Message

Answer Source

You should convert the hours and payRate into integers or floats like so:

hours = int(input("Enter the number of hours worked: "))
payRate = int(input("Enter the hourly pay rate: "))


hours = float(input("Enter the number of hours worked: "))
payRate = float(input("Enter the hourly pay rate: "))

Depending if you want to include only natural numbers or ones with figures after the decimal .

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download