# Diamond Dozen: The Tricky Dozen 13.09/2020

Hello, please check my code, I don’t have time to collect coins, I have time to collect 49 coins

def findBestItem(coin):
bestItem = None
bestValue = 0
itemsIndex = 0
items = hero.findItems()

# Перебери массив предметов.
# Найди предмет с наибольшим значением `valueOverDistance()`.
while itemsIndex < len(items):
item = items[itemsIndex]
if item.value > bestValue:
bestValue = item.value
bestItem = item
itemsIndex += 1
return bestItem

Hi Ivan,

Welcome to the forum!

Your code finds the item with the biggest value. The level requires you to find the item with the biggest {value / distance}. A function that calculates the ‘valueOverDistance’ is given just above.

Hope that helps.

Jenny

Welcome to the forum @IvanFedin!
Can you send me the link for this level?
Thanks, Lydia

Hello, thank you very much for your responsiveness! I already found the error, or rather found the code on the Internet, a very difficult level for me, I had to look for the answer.

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.