[Tutor] Issue with Code

Alan Gauld alan.gauld at yahoo.co.uk
Sat Apr 30 21:00:57 EDT 2016


On 01/05/16 01:16, Alan Gauld via Tutor wrote:

> I can't see anything obviously wrong in your code

I was too busy focusing on the calculations that
I didn't check the 'if' test closely enough.
You need to convert your values from strings
before comparing them.

hours = float(raw_input ('How many hours do you work?\n'))
rate = float(raw_input ('What is your hourly rate?\n'))
if hours > 40:
   gross = (hours-40)*(rate*1.5) + (rate*40)
else:
   gross = hours*rate


Sorry,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list