如何将项目添加到字典中的列表中
how to add items to the list that is in the dictionary
inventory = {
'gold' : 500,
'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf'],
'pocket': ['seashell','strange berry','lint']
}
如何将 'gold' 键下存储的数字加 50
初级,沃森:
inventory['gold'] += 50
inventory = {
'gold' : 500,
'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf'],
'pocket': ['seashell','strange berry','lint']
}
如何将 'gold' 键下存储的数字加 50
初级,沃森:
inventory['gold'] += 50