title: add exceptions to python function
body: <p>I have a function that takes an integer as input and returns the number as words, it works as I want with the exception of <code>30,40,50,60,70,80</code> and <code>90</code>, it returns for <code>90 = ninty zero</code>, because the function works by splitting the number, how can I remove the zero being added for the above numbers. my code is as follows</p>
  
  <pre><code>d = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five',
       6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten',
       11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen',
       15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen',
       19: 'ninteen', 20: 'twenty',
       30: 'thirty', 40: 'fourth', 50: 'fifty', 60: 'sixty',
       70: 'seventy', 80: 'eighty', 90: 'ninty'}
  
  def wordify(n):
      k = 1000
      m = k * 1000
      if n &lt; 20:
          return d[n]
      if n &lt; 100:
          if n % 100 == 0: return d[n]
          else: return d[n // 10 * 10] + ' ' + d[n % 10]
      if n &lt; k:
          if n % 100 == 0: return d[n // 100] + ' hundred'
          else: return d[n // 100] + ' hundred ' + wordify(n % 100)
      if n &lt; m:
          if n % k == 0: return wordify(n // k) + ' thousand'
          else: return wordify(n // k) + ' thousand, ' + wordify(n % k)
  
  
  print wordify(90)
  </code></pre>