On 01/03/17 06:21, darrickbled...@gmail.com wrote:

> wage = eval(input("Enter in the employees hourly wage: ")) #get wage
> hours_worked = eval(input("Enter in the number of hours worked: "))

Don't use eval() like this it is a security risk
and is a very bad habit to get into. Instead use
an explicit type conversion such as int() or float().

> pay = wage * hours_worked # calculate pay
> ot = ((hours_worked - 40 ) *  (1.5) * wage) + (wage * 40) 
> double = ((hours_worked - 40 ) *  (2) * wage) + (wage * 40) 

You don't need all those parentheses around the terms,
especially the numbers.

> if (hours_worked <= 40):
>     print (pay)
> 
> if (hours_worked > 40 and < 60):
>     print (ot)

Python sees this as:

   if (hours_worked > 40) and (< 60):

And doesn't know what is intended to be less than 60.

You need to be explicit:

   if hours_worked > 40 and hours_worked < 60:

You can also write what you intend in a slightly
different form:

   if (40 < hours_worked < 60):

Note:
The second form an unusual style that I've only
ever seen in Python, most languages insist you
use the first version.

HTH
-- 
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


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to