title: Python searching for largest digit in a string of letters and numbers
body: <p>This is a function that takes in a very long string and searches for any numbers in it and returns the largest. I keep getting <code>TypeError: unorderable types: int() &gt; str()</code></p>
  
  <pre><code>def largest_digit(s):
  
    largest = 0
    if len(s) == 0:
      return 0
    else:
      for x in range(len(s)):
        if s[x].isdigit() and if int(s[x]) &gt; largest:
          largest = s[x]
    return largest`
  </code></pre>
  
  <p>Here's the traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "1.py", line 42, in &lt;module&gt;
      main()
    File "1.py", line 36, in main
      x = largest_digit(s)
    File "1.py", line 14, in largest_digit
      if int(s[x]) &gt; largest:
  TypeError: unorderable types: int() &gt; str()
  </code></pre>