这是我目前的代码。你是如何获得从字典中随机选择的值
if Pokémon == 'Charmander':
selectyourmove = input('Select your move: Flamethrower, Fire Fang,
Scratch or Ember: ')#select your move
if selectyourmove == 'Flamethrower':
numberchoosing1 = random.randint(20, 22)#randomly decides
damage of the chosen move in the range
print(choice, 'has lost' ,numberchoosing1, 'health out of its'
,HP, 'health!')
我的字典很简单。它是:
HP = {'Char':'60', 'Squir':'50', 'Pika':'80', 'Eve':'50', 'Bulb':'70', 'Clef':'100'}
所有这些都已被定义。
如何获取随机从字典
另外,你怎么让它打印的健康呢?因为现在,它会打印词典,而不是口袋妖怪的健康 – Kim
只需一秒钟,我会将其添加到答案中 –