question answerers and python wizards,
I am a weary apprentice seeking some help from a fellow traveller.
inventory = {
'gold' : [500, 600, 700, 800],
'pouch' : ['flint', 'twine', 'gemstone'],
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
}
I essentially want to iterate through the 'gold' key and add 50 to each value and have that stored [permanently in the original dictionary]. Now, I know how to do it individually...
inventory['gold'][0] += 50
inventory['gold'][1] += 50
inventory['gold'][n] += n...
but, I'm guessing there must be an easier way to do this task?!!!! Right??!
Any help would be appreciated.
Thank y'all in advance!