Valid year function in python
<p>Here is the udacity.com web dev course, they ask to write a program for valid year, anything between 1900 and 2020 is a valid year...Now when I submit my below code it gives this error: </p>

<p>"Incorrect. Your submission did not return the correct result for the input '1920',. Your submission passed 7 out of 9 test cases."</p>

<p>my function:</p>

<pre><code>def valid_year(year):
  if year and year.isdigit():
    if int(year) &gt;=1900 and int(year) &lt;=2020:
      return year

print valid_year('1970')
</code></pre>

<p>why it's not working for 1920? and the same function by udacity runs fine....Someone pls tell me what's the difference b/n both the code</p>

<p>Udacity function:</p>

<pre><code>def valid_year(year):
  if year and year.isdigit():
    year = int(year)
    if year &gt;=1900 and year &lt;=2020:
      return year

print valid_year('1970')
</code></pre>
