Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- materials = {"shards": 0, "fragments": 0, "motes": 0}
- junk = {}
- legendary_item = ''
- is_collected = False
- while materials["shards"] < 250 and materials["fragments"] < 250 and materials["motes"] < 250:
- data = input().lower()
- tokens = data.split(' ')
- for i in range(0, len(tokens), 2):
- if materials["shards"] >= 250 or materials["fragments"] >= 250 or materials["motes"] >= 250:
- is_collected = True
- break
- quantity = int(tokens[i])
- material = tokens[i + 1]
- if material == "shards" or material == "fragments" or material == "motes":
- materials[material] += quantity
- else:
- if material not in junk:
- junk[material] = 0
- junk[material] += quantity
- if is_collected:
- break
- if materials["shards"] >= 250:
- legendary_item = 'Shadowmourne'
- materials["shards"] -= 250
- elif materials["fragments"] >= 250:
- legendary_item = 'Valanyr'
- materials["fragments"] -= 250
- elif materials["motes"] >= 250:
- legendary_item = 'Dragonwrath'
- materials["motes"] -= 250
- print(f"{legendary_item} obtained!")
- for key, value in sorted(materials.items(), key=lambda item: (-item[1], item[0])):
- print(f'{key}: {value}')
- for key, value in sorted(junk.items(), key=lambda item: (item[0])):
- print(f'{key}: {value}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement