title: Why can't I use max with Python to find maximum one-digit integer in array?
body: <p>I had an interview recently and was asked to solve the following problem using Python:</p>
  <p>Write a function:</p>
  <pre><code>def solution(A):
  </code></pre>
  <p>such that, given an array <code>A</code> consisting of N integers, it returns the maximum among all one-digit integers.</p>
  <p>For example, given array A as follows:</p>
  <pre><code>[-6, -91, 1011, -100, 84, -22, 0, 1, 473]
  </code></pre>
  <p>the function should return 1.</p>
  <p>Assume that:</p>
  <ul>
  <li>N is an integer within the range [1...1,000]</li>
  <li>Each element of array <code>A</code> is an integer within the range [-10,000..10,000].</li>
  <li>There is at least one element in array <code>A</code> which satisfies the condition in the task statement.</li>
  </ul>
  <p>I came up with the following solution which I thought was elegant, but the score I got was only 55%:</p>
  <pre><code>def solution(A):
      return max([i for i in A if len(str(i))==1])
  </code></pre>
  <p>Why is this solution incorrect?</p>