Syntax error, "ParseError: bad input on line 9"

0

I am learning Python and I have this exercise:

  

4.6 Write to program to prompt the user for hours and rate per hour using input to compute gross pay. Award time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to the computation of time-and-a-half in a function called computepay () and use the function to do the computation. The function should return to value. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should use input to read a string and float () to convert the string to a number. Do not worry about error checking the user input unless you want to - you can assume the user types numbers properly. Do not name your variable sum or use the sum () function.

My answer is this:

def compute_pay(hours):       
    if hours <= 40:
       pay = pay * hours
       return pay

hours = float(raw_input("Enter Hours:"))   
pay = float(raw_input("Enter Rate:")) 

print compute_pay(hours)  

But when he runs it, he says:

  

"ParseError: bad input on line 9"

    
asked by Nay Rojas 23.11.2017 в 22:34
source

0 answers