title: Python - find greatest 2 of 3 numbers WITHOUT using max()
body: <p>I am looking for the answer to the same question found here:</p>
  
  <p><a href="https://stackoverflow.com/questions/3090175/python-find-the-greatest-number-in-a-set-of-numbers">Python - Find the greatest number in a set of numbers</a></p>
  
  <p>However, I would like to build my own program instead of using the built-in function <code>max()</code>. This is what I have right now, but it's throwing an error, I think because of variable scope.</p>
  
  <pre><code>def two_of_three(a, b, c):
      if a&gt;=b:
          x=a
      else:
          x=b
      if b&gt;=c:
          y=b 
      else:
          y=c
      if a&gt;=c:
          x=a
      else:
          x=c
      return x**x+y**y
  
  assert two_of_three(3,4,5)==41
  assert two_of_three(0,1,2)==5
  assert two_of_three(9,21,89)==8362
  </code></pre>
  
  <p>Here is the error I am getting: </p>
  
  <pre><code>Traceback (most recent call last):
  File "python_hw1.py", line 32, in &lt;module&gt;
  assert two_of_three(3,4,5)==41
  AssertionError
  </code></pre>