擅长:python、mysql、java
<p>您可以使用<a href="http://docs.python.org/2/reference/expressions.html#conditional-expressions" rel="nofollow">ternary expression</a>:</p>
<pre><code>minscore = 100 if day else 10 if month else 1
</code></pre>
<p>从<a href="http://www.python.org/dev/peps/pep-0308/" rel="nofollow">pep-308</a>(条件表达式):</p>
<blockquote>
<p>The motivating use case was the prevalance of error-prone attempts
to achieve the same effect using "and" and "or".</p>
</blockquote>