title: write your pay computation with time-and-a-half for overtime and create a function called computepay which takes two parameters (hours and rate)
body: <p>For the above question i have written this code . Math formula is correct but it is not giving the correct answer where is the fault?</p>
  <pre><code>def computepay(hours, rate):
      if hours&lt;=40:
          pay = hours * rate
      else:
          pay = (((hours-40)*rate)*1.5)+rate*40
          return pay
  x = input(&quot;Enter hours: &quot;)
  y = input(&quot;Enter rate: &quot;)
  a = float(x)
  b = float(y)
  pay = computepay(a, b)
  print(&quot;Pay: &quot;, pay)
  </code></pre>