hey guys, I’ve just started to learn python, I’ve watched a lot of tutorials and wanted to make something to help me sort items in a dungeons and dragons game. I keep looking through my code but I don’t understand what I’m doing wrong. Can anybody offer me some guidance or suggestions on how I might fix it. thank you in advance.
code is attached below
inventory = ['Axe', 'Great Sword', 'Stick', 'Heath Potion']
rarity = {
" The Necronomicon": 500,
"Wand": 100,
"Great sword": 98,
"Staff": 96,
"Golden Bow": 94,
"Alchemist's supplies": 87,
"Shovel": 84,
"Iron Sword": 80,
"Bow": 78,
"Health Potion": 75,
"Potion of Speed": 75,
"Dagger": 45,
"Axe": 34,
"Lamp": 15,
"BackPack": 10,
"Torch": 7,
"Mess Kit": 5,
"rock": 1,
"Stick": 1,
}
sort_inv = sorted(inventory, key=rarity.get, reverse=True)
print(sort_inv)