title: Sorting three numbers in ascending order without using functions
body: <p>One of my assignments is to write a python program that sorts three numbers in ascending orders without use of any functions like sort or swap.</p>
  <p>This is the first thing I came up with:</p>
  <pre><code>a = float(input(&quot;Enter a: &quot;))
  b = float(input(&quot;Enter b: &quot;))
  c = float(input(&quot;Enter c: &quot;))
  if a &lt; b:
      if b &lt; c:
          print (a, &quot;&lt;&quot;, b, &quot;&lt;&quot;, c)
      else:
          if a &lt; c:
              print (a, &quot;&lt;&quot;, c, &quot;&lt;&quot;, b)
          else:
              print (c, &quot;&lt;&quot;, a, &quot;&lt;&quot;, b)
  else:
      if c &lt; b:
          print (c, &quot;&lt;&quot;, b, &quot;&lt;&quot;, a)
      else:
          if c &lt; a:
              print (b, &quot;&lt;&quot;, c, &quot;&lt;&quot;, a)
          else:
              print (b, &quot;&lt;&quot;, a, &quot;&lt;&quot;, c)
  </code></pre>
  <p>My teacher said to try and simplify it so I wrote this next (which basically is a roundabout way to use swap):</p>
  <pre><code>a = float(input(&quot;Enter a: &quot;))
  b = float(input(&quot;Enter b: &quot;))
  c = float(input(&quot;Enter c: &quot;))
  if a &gt; c:
      a = a + c
      c = a - c
      a = a - c  
  if a &gt; b:
      a = a + b
      b = a - b
      a = a - b
  if b &gt; c:
      b = b + c
      c = b - c
      b = b - c
  print (a, &quot;&lt;&quot;, b, &quot;&lt;&quot;, c)
  </code></pre>
  <p>So I guess my question is whether it can be more simplified than this and what that would look like.</p>