Shine Getter Python

So my problem is I collect coins but I can’t get to 100 I keep running out of time. Can anyone give me help on this?`
while True:
coins = hero.findItems()
coinIndex = 0

# Wrap this into a loop that iterates over all coins.
while coinIndex < len(coins):
    coin = coins[coinIndex]
    hero.moveXY(coin.pos.x, coin.pos.y)
    coinIndex += 1
# Gold coins are worth 3.
if coin.value == 3:
    # Only pick up gold coins.
    hero.moveXY(coin.pos.x, coin.pos.y)

If you move to collect coins, then when do you do this:

If you only use the first bit of code, the second bit will never get executed.
:lion: :lion: :lion: