擅长:python、mysql、java
<p>用<code>==</code>代替<code>is</code>。还要注意<code>==</code>应该匹配<strong>每个字符</strong>,这样才是真的(这有点奇怪,但请记住这一点),因此,如果您有一个名为“<strong>L</strong>ocal”的选择,并且您正试图与“<strong>L</strong>ocal”进行比较,那就不一样了。你知道吗</p>
<p>您的代码应该如下所示:</p>
<pre><code>def Validation():
if election == 'EU' or election == 'UK':
if age < 110 and age > 18:
print('You are eligable to vote in this election')
else:
print('You are not eligable to vote in this election')
if election == 'Scottish' or election == 'local':
if age < 110 and age > 16:
print('You are eligable to vote in this election')
else:
print('You are not eligable to vote in this election')
</code></pre>