Level: Shine Getter - Python

I am not sure what I need to do to make this work. I am not asking for the solution, but rather a hint to get it working.

Edit - I fixed my code to where it will not pick up all coin if I change if coin.value == 3: to if coin.value > 0:

coin = self.findItems()
coinIndex = 0 
while coinIndex < len(coin):
    coin = coin[coinIndex]
    if coin.value == 3:
        pos = coin.pos
        x = pos.x
        y = pos.y
        self.moveXY(x, y)
coinIndex += 1

Fixed it. I got my ‘coin’ and ‘coins’ confused I believe.


yeah, that and the paste bin code is indented correctly.

Yeah. I am not sure if my copy and paste didn’t move over correctly? I think it was fine in-game. I could be wrong. I made a lot of changes.

Did you use three back ticks at the head and foot of the code (see the FAQ)? I just learned about this and it fixes all the copy and paste formatting errors.

Guys. My code doesn’t work. Can u tell me what i did wrong?
loop: {
var coins = this.findItems();
var coinIndex = 0;

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


@Captain_Tater Remove the colon from loop: { — it should be loop {
Or you can also use the equivalent standard form: while (true) {

I did what you told me, and its still red.

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

# Wrap this into a loop that iterates over all coins.
while True:
    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

this is my code what am i doing wrong?

     thanks for the help.but  why can't use while true: