Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 05. Legendary Farming 100/100
- # Dictionaries - Exercise
- # https://judge.softuni.org/Contests/Compete/Index/1737#4
- materials = input()
- legendary = {'shards': 'Shadowmourne', 'fragments': 'Valanyr', 'motes': 'Dragonwrath'}
- key_materials = {'shards': 0, 'fragments': 0, 'motes': 0}
- junk = {}
- obtained = False
- final_print = ""
- while not obtained:
- details = materials.split(' ')
- for index in range(0, len(details), 2):
- amount = int(details[index])
- material = details[index + 1].lower()
- if material in legendary.keys():
- key_materials[material] += amount
- if key_materials[material] >= 250:
- key_materials[material] -= 250
- final_print = legendary[material]
- obtained = True
- print(f'{final_print} obtained!')
- break
- else:
- if material not in junk.keys():
- junk[material] = amount
- else:
- junk[material] += amount
- if not obtained:
- materials = input()
- for key, value in key_materials.items():
- print(f'{key}: {value}')
- for key, value in junk.items():
- print(f'{key}: {value}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement