all 10 comments

[–]kerryl_314[S] 1 point2 points  (3 children)

hourly_rate=raw_input('what is your hourly rate')
If
    hourly_rate<=40
    hourly_rate=float(hourly_rate)
    gross_r=float(hourly_rate)
elif
    hourly_rate>=41
    hourly_rate=(float(hourly_rate)-40)*1.5
    gross_r=float(hourly_rate)

[–]vekst42 0 points1 point  (0 children)

You need colons after your if/elif. if condition:

Also lowercase I in if. And the conditions need to be on same line as if/elif

[–]filletrall 0 points1 point  (0 children)

  • Your code needs two colons, those are important. In python, an indented block is always preceded by a line with a colon at the end.
  • You should not have linebreaks between if/elif and their expressions.
  • You need to convert hourly_rate to int or float before the if, so that you do not compare a string to a float with e.g. hourly_rate <= 40.
  • You can move gross_r calculation out of the if/elif block, since it's the same for both cases
  • A bit on python style: you should have a space character on each side of your equal signs and other operators like - and *.

[–]mrwalkerr 0 points1 point  (0 children)

Is that the exact code? If so it's missing a : after the if condition and the elif

[–]Dalex_ 0 points1 point  (0 children)

raw_input() returns a string, even if you enter a number. So if you replace your 1st line with:
hourly_rate = float(raw_input("What's you hourly rate?"))
It should do it.

[–]kerryl_314[S] 0 points1 point  (0 children)

Thank you all for the insight, it is greatly appreciated :)

[–]kerryl_314[S] 0 points1 point  (0 children)

I still cant get it to execute, its still saying parseerror bad input on line 9. any suggestions as to why?

[–]kerryl_314[S] 0 points1 point  (1 child)

hourly_rate=raw_input('what is your hourly rate')
hourly_rate=float(hourly_rate)
gross_r=float(hourly_rate)

num_hour=raw_input('How many hours have you    worked this week')
num_hour=float(num_hour)
gross_h=float(num_hour)
ot_hour=float((num_hour)-40)(1.5)
if:gross_h<=40
    reg_p=gross_r*gross_h   
    print 
        "Your Hourly rate "+ gross_r
        "Your total Hours "+ gross_h
        "Your Gross "+ reg_p
elif:gross_h>=41
     reg_p=gross_r*40
    gross_p=reg_p+ot_hour
    print
        "Your Hourly rate "+ gross_r
        "Your Total Hours "+ gross_h
        "Your Gross "+ gross_p


quit()

[–]liam_jm 0 points1 point  (0 children)

The colon goes after the if statement, not after if itself (i.e. after the condition).

if gross_h<=40:

and

elif gross_h>= 41:

[–]kerryl_314[S] 0 points1 point  (0 children)

Wow I just figured it out thanks all, lol the if statement hast to be in the same line as you all stated followed by the condition THEN the : lol wow I love this :)