擅长:python、mysql、java
<p>您的示例当前没有词典。你搞错了。具体如下:</p>
<pre><code>statlist = {"attribute_name" : attribute_value, REPEAT}
</code></pre>
<p>一旦你有了正确的字典初始化</p>
<pre><code>statlist = {'small guns' : 5, 'big guns' : 2, 'unarmed' : 3} # you do the rest
choice = raw_input("Which stat do you want to add points to?")
if choice in statlist:
pointDeduction = input("How many points do you wish to add to %s? (Up to %s points)" %(choice, skillPoints))
if pointDeduction <= statlist[choice]:
statlist[choice] -= pointDeduction
skillPoints -= pointDeduction
else:
print "You do not have that many points to distribute to %s." %(choice)
</code></pre>
<p>在分发点时,您也有一些逻辑问题,但您可以自己解决。你知道吗</p>