title: Python: Program for getting maximum and minimum value without using max and min function
body: <p>I wrote the code below for getting max and min values as part of my MOOC assignment. This program continuously takes input from the user until the user types 'done'. </p>
  
  <p>Once 'done' is typed, the program  gives the results for max and min values. The problem is that the result for max value is always correct, but the result for min value is always "None".</p>
  
  <pre><code>largest = None
  smallest = None
  while ( True ) :
      inp = raw_input('Enter a number: ')
      if inp == 'done' :
          break
      try:
          inp = float(inp)
      except:
          print 'Invalid input'
      continue
      if inp is None or inp &gt; largest:
          largest = inp
      if inp is None or inp &lt; smallest:
          smallest = inp
  print largest, smallest
  </code></pre>