Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sort_materials(user_input, important_materials, useless_materials):
- for i in range(0, len(user_input), 2):
- quantity_material = int(data[i])
- material = data[i + 1].lower()
- if material == "shards":
- important_materials['shards'] += quantity_material
- elif material == "fragments":
- important_materials['fragments'] += quantity_material
- elif material == "motes":
- important_materials['motes'] += quantity_material
- else:
- if material not in useless_materials:
- useless_materials[material] = 0
- useless_materials[material] += quantity_material
- def obtain_legendary_item(important_materials, legendary_item_slot):
- if important_materials['shards'] >= 250:
- legendary_item_slot = "Shadowmourne"
- important_materials['shards'] = important_materials['shards'] - 250
- print(f"{legendary_item_slot} obtained!")
- elif important_materials['fragments'] >= 250:
- legendary_item_slot = "Valanyr"
- important_materials['fragments'] = important_materials['fragments'] - 250
- print(f"{legendary_item_slot} obtained!")
- elif important_materials['motes'] >= 250:
- legendary_item_slot = "Dragonwrath"
- important_materials['motes'] = important_materials['motes'] - 250
- print(f"{legendary_item_slot} obtained!")
- key_materials = {'shards': 0, 'fragments': 0, 'motes': 0}
- junk = {}
- legendary_item = " "
- while legendary_item == " ":
- data = input().split()
- sort_materials(data, key_materials, junk)
- obtain_legendary_item(key_materials, legendary_item)
- for item, quantity in sorted(key_materials.items(), key=lambda kvp: (-kvp[1], kvp[0])):
- print(f"{item}: {quantity}")
- for junk_item, junk_quantity in sorted(junk.items(), key=lambda kvp: kvp[0]):
- print(f"{junk_item}: {junk_quantity}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement