[SOLVED] Please help me with reindeer wakeup

help me out on this level please, i don’t know what to change.
here’s my code:

# This array contains the status for each reindeer.
deerStatus = "asleep"

# And this array contains our reindeer.
friends = hero.findFriends()

# Loop through the reindeer and find the awake ones:
for deerIndex in range(len(friends)):
    reindeer = friends[deerIndex]

    # Reindeer with y position > 30 aren't in a pen.
    # If so, set the reindeer's entry to "awake".
if reindeer.pos.y > 30:
    deerStatus = "awake"
    pass

# Loop through statuses and report to Merek.
for statusIndex in range(len(deerStatus)):
    # Tell Merek the reindeer index and its status.
    # Say something like "Reindeer 2 is asleep".
    hero.say("Reindeer" + " " + deerIndex + " " + "is" + " " + deerStatus)
    pass

1 Like

@AnSeDra, can you help me please?

1 Like

i have to go in 5 minutes

1 Like

I will try to help you.

2 Likes

thanks @AnSeDra! :grin:

1 Like

Those should be in this for loop.

Does it work now?

2 Likes

it doesn’t… he say it once and once only. and for an awake reindeer

1 Like

Here you say an array. Try to say the deerIndex element of the array instead.
Does it work now?

2 Likes

where? (20 characters)

1 Like

Here. Do you need any more assistance at this level?

2 Likes

but the hero say a number for the name and still only says it once

1 Like

Can you show me your code again?

2 Likes

i have to go really soon

1 Like

but here:

# This array contains the status for each reindeer.
deerStatus = "asleep"

# And this array contains our reindeer.
friends = hero.findFriends()

# Loop through the reindeer and find the awake ones:
for deerIndex in range(len(friends)):
    reindeer = friends[deerIndex]
    # Reindeer with y position > 30 aren't in a pen.
    # If so, set the reindeer's entry to "awake".
    if reindeer.pos.y > 30:
        deerStatus = "awake"
    pass

# Loop through statuses and report to Merek.
for statusIndex in range(len(deerStatus)):
    # Tell Merek the reindeer index and its status.
    # Say something like "Reindeer 2 is asleep".
    hero.say("Reindeer" + " " + deerIndex + " " + "is" + " " + deerStatus)
    pass

1 Like

On this line, here:

Try to only say the statusIndex element of the array deerStatus instead of the whole array deerIndex.

2 Likes

i need to go… see you in a while! :grin:

2 Likes

On the same line, here:

Put statusIndex instead because the for loop changes the statusIndex variabile, not the deerIndex variabile.
Do you need any more assistance at this level?

2 Likes

When you will be back, I hope that @dedreous will guide you further throught this level if you need to because I am going to bed. Bye!

2 Likes

@dedreous, are you here? because i need help. my her o just says letters like k, w, a. why?
here’s my code:

# This array contains the status for each reindeer.
deerStatus = [ 'asleep', 'asleep', 'asleep', 'asleep', 'asleep' ]

# And this array contains our reindeer.
friends = hero.findFriends()

# Loop through the reindeer and find the awake ones:
for deerIndex in range(len(friends)):
    reindeer = friends[deerIndex]
    # Reindeer with y position > 30 aren't in a pen.
    # If so, set the reindeer's entry to "awake".
    if reindeer.pos.y > 30:
        deerStatus = "awake"
    pass

# Loop through statuses and report to Merek.
for statusIndex in range(len(deerStatus)):
    # Tell Merek the reindeer index and its status.
    # Say something like "Reindeer 2 is asleep".
    hero.say("Reindeer" + " " + deerIndex + " " + "is" + " " + deerStatus[statusIndex])
    pass

1 Like

ooooohhhhh. he’s spelling awake :rofl:

1 Like