Help I am stuck in Shine Getter

Here is my code but I still cannot complete it help!

while True:
coins = hero.findItems()
coinIndex = 0

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

please help!!!

Welcome to the forum! This is a family-friendly place where coders can share bugs, ask for help on any CodeCombat level (don’t forget to post your code correctly), or just hang out with other coders. But before you proceed, please check out our guidelines: this topic.
Have a great time! :partying_face:

Can you please format your entire code? It’s easier to understand.

Look closely at this line.

There are two mistakes.

It is still not working …

@Jacqueline

Put the if statement inside the while loop. Like this:

while (stuff):
     blah blah blah
     if (stuff):
          blah blah blah

Second, your hero.moveXY has mistakes. Please check again.

Has mistakes (More than one)

Hope that helps, and welcome to CoCo Discourse. :slight_smile:

1 Like

Will you post your current code please?

while coinIndex < len(coins):
coin = coins[coinIndex]
#Gold coins are worth 3.
if coin.value == 3:
# Only pick up gold coins.
hero.moveXY(coin.pos.x, coin.pos.y)
coinIndex += 1
pass

But I already put one if statement inside the while loop

Put it all in a while-loop Lol

Why did you take this out?
while True:
coins = hero.findItems()
coinIndex = 0

The hint and the chat told me to do so

Everyone I solved it ! I do what you teached and told me and I solved it! Thanks everyone!

2 Likes

That’s great you fixed it congrats!

Awesome! Glad you solved it!

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