Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: Python  |  size: 0.37 KB  |  hits: 39  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/python
  2.  
  3. # P2PU - Python Programming 101 - Chapter 6 - Flow Control
  4. # Python for Informatics - Chapter 3 - Conditional Execution
  5. # Exercise 3.1
  6. print '\n# Exercise 3.1\n'
  7. hours = float(raw_input('Enter Hours: '))
  8. rate  = float(raw_input('Enter Rate : '))
  9. pay   = hours * rate
  10. if hours > 40 : pay = pay + (hours - 40) * rate * 0.5
  11. print 'Pay:', round(pay,2)