title: How do I change a value of a variable using an if else statement?
body: <p>I've been on it for days but nothing is helping. The value of smallest does not change no matter what i do. it does not happen with the value of largest although it uses almost the same line of code.</p>
  
  <pre><code>smallest = None
  largest = None
  while True:
      num = raw_input("Enter a number: ")
      if num == "done":
          break
      try:
          x = int(num)
          if x &lt; smallest:
              smallest = x
          elif x &gt; largest:
              largest = x
      except:
          print"Invalid input"
          continue
  print "Maximum is", largest
  print "Minimum is", smallest
  </code></pre>