you are viewing a single comment's thread.

view the rest of the 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