# \[SOLVED\] Help in Yeti Away and Medic School levels

**URL:** <https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439>\
**Category:** Level Help\
**Created:** [March 22, 2022, 8:27pm UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439 "2022-03-22T20:27:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WaWa\_Yang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wawa_yang/32/17800_2.png) [@WaWa\_Yang](https://discourse.codecombat.com/u/WaWa_Yang)\
**Post date:** [March 22, 2022, 8:27pm UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439/1 "2022-03-22T20:27:53Z")

</div>

Hello all! I’ve been stuck on the levels above. Here’s my code for Yeti Away:

```python
# Follow one of the peasants and escape from the yeti.
hero.phaseShift()
def startsWith(phrase, word):
    if len(word) > len(phrase):
        return False
    # Iterate indexes from 0 to the length of the word.
    for i in range(len(0, len(word))):
        # Check the letter of phrase and word at index i
        word = word[i]
        phrase = phrase[i]
        # If they are not equal:
        if word != phrase:
            # Then return False.
            return False
    # All letters in the word checked, then return true.
    return True

# Follow the local guide whose name starts with "Mac".
guides = hero.findFriends()
for gIndex in range(len(guides)):
    guide = guides[gIndex]
    if startsWith(guide.id, "Mac"):
        while True:
            hero.move(guide.pos)

```

It worked the first time but on the second(third and so on) submit, my hero keeps following the top peasant  
[link(Yeti Away)](https://codecombat.com/play/level/yeti-away?). As for the [Medic School](https://codecombat.com/play/level/medic-school?) level, being very similar to Yeti way, should be easy to solve after solving the Yeti level. All help is appreciated 😄

---

<div class="post-metadata">

**Author:** ![herokolbert](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/herokolbert/32/34618_2.png) [@herokolbert](https://discourse.codecombat.com/u/herokolbert)\
**Post date:** [March 22, 2022, 9:08pm UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439/2 "2022-03-22T21:08:59Z")

</div>

startsWith does not make sense  
what if the phrase is Macdaddy  
not equal, but starts with Mac

---

<div class="post-metadata">

**Author:** ![herokolbert](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/herokolbert/32/34618_2.png) [@herokolbert](https://discourse.codecombat.com/u/herokolbert)\
**Post date:** [March 22, 2022, 9:16pm UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439/3 "2022-03-22T21:16:54Z")

</div>

You need to make something that will make an array for each character in `phrase`  
then you can check the first three terms and see if they are M, A, and C.

---

<div class="post-metadata">

**Author:** ![WaWa\_Yang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wawa_yang/32/17800_2.png) [@WaWa\_Yang](https://discourse.codecombat.com/u/WaWa_Yang)\
**Post date:** [March 23, 2022, 12:14am UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439/4 "2022-03-23T00:14:43Z")

</div>

> [@herokolbert](#):
>
> startsWith does not make sense

It came with the default code so 🤷.

> [@herokolbert](#):
>
> You need to make something that will make an array for each character in `phrase`

So something like

```python
a = phrase
m = phrase
b = phrase

apples = A
Michael = apples
macros = M
hero = macros
bananas = B
fruits = bananas

```

?

---

<div class="post-metadata">

**Author:** ![Aya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aya/32/42680_2.png) [@Aya](https://discourse.codecombat.com/u/Aya)\
**Post date:** [March 23, 2022, 6:40am UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439/5 "2022-03-23T06:40:27Z")

</div>

I see only 2 tiny problems,

> [@WaWa\_Yang](#):
>
> `range(len(0, len(word)))`

This is too complicated, no need for the len where it has the zero and another length  
Hint: range(len(word))

> [@WaWa\_Yang](#):
>
> ```python
> word = word[i]
> phrase = phrase[i]
> 
> ```

Give the variables different names, so w = word[i] for example, same for phrase

---

<div class="post-metadata">

**Author:** ![WaWa\_Yang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wawa_yang/32/17800_2.png) [@WaWa\_Yang](https://discourse.codecombat.com/u/WaWa_Yang)\
**Post date:** [March 24, 2022, 12:34am UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439/6 "2022-03-24T00:34:29Z")

</div>

It worked! Thx @Aya, (Yea and it also worked for Medic school)

> **hint(to whoever is stuck on this level(Medic school))**
>
> It’s literally the same code just with extra movement to the potions

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [March 24, 2022, 12:34pm UTC](https://discourse.codecombat.com/t/solved-help-in-yeti-away-and-medic-school-levels/32439/7 "2022-03-24T12:34:31Z")

</div>

Closed on March 24, 2022, 12:34pm UTC

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