title: caught speeding - CodingBat
body: <p>most of you are aware of the 'caught speeding' coding problem on CodingBat. I have tried to solve it as below. i am not quite sure why it did not work there. i have viewed other solutions. and i believe the logic is similar but with some differences in implementation. </p>
  
  <p>"You are driving a little too fast, and a police officer stops you. Write code to compute the result, encoded as an int value: 0=no ticket, 1=small ticket, 2=big ticket. If speed is 60 or less, the result is 0. If speed is between 61 and 80 inclusive, the result is 1. If speed is 81 or more, the result is 2. Unless it is your birthday -- on that day, your speed can be 5 higher in all cases."</p>
  
  <p>my code: </p>
  
  <pre><code>def caught_speeding(speed, is_birthday):
    while not is_birthday:
      speed = range(0,81)
      if speed &lt;= 60:
        return 0
      elif speed &gt; 65 and speed &lt; 80:
        return 1
      else: 
        if speed &gt; 81:
          return 2
    return speed - 5
  </code></pre>