0

I've been practising using functions and I cannot figure out why Python is suggesting one of my variables is a 'nonetpye' - Any advice would be great.

My code looks like this:

def gethoursandrate():
    hours = -1
    rate = -1
    while hours < 0 or hours > 60:
        hours = int(input('Please enter the number of hours worked: '))
        hours = int(hours)
    while rate < 0:
        rate = input('Please enter the hourly rate of pay: £')
        rate = float(rate)
    return hours, rate


def calculatebasicpay(hours, rate):
    basicpay = 0
    if hours > 40:
        hours = 40
    basicpay = hours * rate
    return basicpay


def calculateovertimepay(hours, rate):
    overtimepay = 0
    overtimehours = 0
    if hours > 40:
        overtimehours = hours - 40
    overtimepay = overtimehours * rate * 1.5


def displaytotalpay(totalpay):
    totalpay = round(totalpay, 2)
    print('Pay due for the week is: £{0}'.format(totalpay))


print('\n Pay Calculator \n')
basicpay = 0
overtimepay = 0
hours, rate = gethoursandrate()
basicpay = calculatebasicpay(hours, rate)
overtimepay = calculateovertimepay(hours, rate)
totalpay = basicpay + overtimepay
displaytotalpay(totalpay)

This is what I get when I run the code

0 Answers0