title: Python - Find second smallest number
body: <p>I found this code on this site to find the second largest number:</p>
  
  <pre><code>def second_largest(numbers):
      m1, m2 = None, None
      for x in numbers:
          if x &gt;= m1:
              m1, m2 = x, m1
          elif x &gt; m2:
              m2 = x
      return m2
  </code></pre>
  
  <p>Source: <a href="https://stackoverflow.com/questions/16225677/get-the-second-largest-number-in-a-list-in-linear-time">Get the second largest number in a list in linear time</a></p>
  
  <p>Is it possible to modify this code to find the second <em>smallest</em> number? So for example</p>
  
  <pre><code>print second_smallest([1, 2, 3, 4])
  2
  </code></pre>