Guest User

Untitled

a guest
May 24th, 2016
2,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. try: # check if they are numbers or not
  2.     # read the hours and convert them to number
  3.     hours = raw_input("How many hours are you working?")
  4.     hours = float(hours)
  5.    
  6.     # read the rate and covert it to number
  7.     rate = raw_input("Enter the rate: ")
  8.     rate = float(rate)
  9.    
  10.     # check to see if the numbers are not negative
  11.     if rate < 0:
  12.         print "The rate can not be negative."
  13.     else:
  14.         if hours < 0:
  15.             print "The hours can not be negative"
  16.         else:
  17.             if hours > 40:
  18.                 print 40 * rate + (hours - 40) * (rate * 1.5)
  19.             else:
  20.                 print rate * hours
  21.    
  22. except:
  23.     print "Enter numbers the next time, duude!"
Advertisement
Add Comment
Please, Sign In to add comment