validation

This commit is contained in:
Mark Pilgrim
2009-07-27 04:23:48 -04:00
parent 8b04ec5971
commit df6b32e6f3
+2 -2
View File
@@ -406,7 +406,7 @@ FAILED (failures=2)</samp></pre>
<p class=d>[<a href=examples/roman3.py>download <code>roman3.py</code></a>]
<pre><code class=pp>def to_roman(n):
'''convert integer to Roman numeral'''
<a> if not (0 < n < 4000): <span class=u>&#x2460;</span></a>
<a> if not (0 &lt; n &lt; 4000): <span class=u>&#x2460;</span></a>
<a> raise OutOfRangeError('number out of range (must be 0..3999)') <span class=u>&#x2461;</span></a>
result = ''
@@ -494,7 +494,7 @@ FAILED (failures=1)</samp></pre>
<pre><code class=pp>def to_roman(n):
'''convert integer to Roman numeral'''
if not (0 < n < 4000):
if not (0 &lt; n &lt; 4000):
raise OutOfRangeError('number out of range (must be 0..3999)')
<a> if not isinstance(n, int): <span class=u>&#x2460;</span></a>
<a> raise NotIntegerError('non-integers can not be converted') <span class=u>&#x2461;</span></a>