擅长:python、mysql、java
<p>我刚刚给你写了这封信,应该可以很好地工作</p>
<pre><code>done = False
owned_poks = []
poks_levels = []
while not done:
line = input('Command: ')
if line:
parts = line.split()
if parts[0] == 'Capture' and not parts[1] in owned_poks:
owned_poks.append(parts[1])
poks_levels.append(parts[2])
print('Captured!')
elif parts[0] == 'Query' and parts[1] in owned_poks:
print('{} is level {}'.format(parts[1], poks_levels[owned_poks.index(parts[1])]))
elif parts[0] == 'Capture' and parts[1] in owned_poks:
print('You already have this pokemon')
elif parts[0] == 'Query' and not parts[1] in owned_poks:
print('you dont have this poke')
else:
print('Unkown command')
else:
done = True
</code></pre>