title: "Counting digits" on numbers input by user (Python 2.x)
body: <p>Please bear with my novice question as I just started learning Python (2.x).
  I'm trying to run a script where user could enter any number (e.g. ints or float) and the expected output would be the total digit numbers of that input number.</p>
  
  <p>However, I've encountered the following problems and wondered if you could kindly help guide me through solving them.  Many thanks!!  :)</p>
  
  <p>(problems)</p>
  
  <ol>
  <li><p>In the printout message, the n value was always 0; whereas I wished to print out the original input number by the user.</p></li>
  <li><p>I wished it would also process the float number.  For now, a 'ValueError' was returned and the script was halted whenever a float number was entered.</p></li>
  <li><p>If user enters any string or blank character, the script should ignore the input and repeat all over again asking for the user input until the number with correct format (i.e. either integer or float number) was entered.</p></li>
  </ol>
  
  <p>&nbsp;</p>
  
  <pre><code>def num_digits(n):
      count = 0
      while n:
          count = count + 1
          n = n/10
      print 'The total digits for this number, ', n, ', are: ', count
      return count
  
  user_input = abs(int(raw_input('Enter a number:\n')))
  num_digits(user_input)
  </code></pre>