回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我这里有个密码:</p>
<pre><code>print('Hello Alex! Please tell me how many different shells you collected.')
pukaAlex = int(input('Puka: '))
coneAlex = int(input('Cone: '))
driftwoodAlex = int(input('Driftwood: '))
seaglassAlex = int(input('Sea Glass: '))
starfishAlex = int(input('Starfish: '))
lstAlex = [pukaAlex, coneAlex, driftwoodAlex, seaglassAlex, starfishAlex]
print('Hello Bay! Please tell me how many different shells you collected.')
pukaBay = int(input('Puka: '))
coneBay = int(input('Cone: '))
driftwoodBay = int(input('Driftwood: '))
seaglassBay = int(input('Sea Glass: '))
starfishBay = int(input('Starfish: '))
lstBay = [pukaBay, coneBay, driftwoodBay, seaglassBay, starfishBay]
lstAlexTwo = [('Puka', pukaAlex), ('Cone', coneAlex),
('Driftwood', driftwoodAlex), ('Sea Glass', seaglassAlex),
('Starfish', starfishAlex)]
lstBayTwo = [('Puka', pukaBay), ('Cones', coneBay),
('Driftwood', driftwoodBay), ('Sea Glass', seaglassBay),
('Starfish', starfishBay)]
print('Alex\'s List: ', lstAlexTwo)
print('Bay\'s List: ', lstBayTwo)
</code></pre>
<p>我知道我有其他组合列表的选项,但是我不完全确定如何将Alex和Bay列表中的Pukas和cone的数量与<strong><code>for</code>循环组合起来,从而创建一个新的列表。你知道吗</p>
<p>我知道我可以使用+字符来添加这两个字符</p>
<p>样本输出:</p>
<pre class="lang-none prettyprint-override"><code>[('Puka', 52), ('Cone', 21)]
</code></pre>
<p>假设收集的普卡犬总数为52只,球果为21只。你知道吗</p>