# Help with spy among us

**URL:** <https://discourse.codecombat.com/t/help-with-spy-among-us/12541>\
**Category:** Uncategorized\
**Created:** [September 25, 2017, 5:44pm UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541 "2017-09-25T17:44:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajdv](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@ajdv](https://discourse.codecombat.com/u/ajdv)\
**Post date:** [September 25, 2017, 5:44pm UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541/1 "2017-09-25T17:44:13Z")

</div>

for some reason it keeps saying that the spy is a friend. pleas help

```python
# The inner gate can hold for a long time.
# However, one of these peasants is an OGRE SPY!
# There is a hint! The spy's name has the letter "z"

# This function checks for a specific letter in a word.

# A string is just an array! Loop over it like an array
def letterInWord(word, letter):
    for i in range(len(word)):
        character = word[i]
        # If character is equal to letter, return True
        if character == "Zozo":
            return True
    # The letter isn't in the word, so return False
    return False
while True:
    
    
    spyLetter = "z"
    friends = hero.findFriends()
    
    for friend in friends:
        friendName = friend.id
        if letterInWord(friendName, spyLetter):
            # Reveal the spy!
            
            hero.say(friendName + " is a spy!")
        else:
            hero.say(friendName + " is a friend.")

```

---

<div class="post-metadata">

**Author:** ![byobcello](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/byobcello/32/6684_2.png) [@byobcello](https://discourse.codecombat.com/u/byobcello)\
**Post date:** [September 25, 2017, 6:43pm UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541/2 "2017-09-25T18:43:44Z")

</div>

Take a look at the function header for `letterInWord`:

```python
def letterInWord(word, letter):

```

You haven’t used the variable `letter` in the function.

* * *

Also, the `while True:` is not necessary.

---

<div class="post-metadata">

**Author:** ![kaiduck](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kaiduck](https://discourse.codecombat.com/u/kaiduck)\
**Post date:** [September 28, 2017, 12:28am UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541/3 "2017-09-28T00:28:06Z")

</div>

Note: manually finding the name won’t help, because it will change every time. You actually have to find the name of the spy with the function.

---

<div class="post-metadata">

**Author:** ![itik](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/itik/32/28431_2.png) [@itik](https://discourse.codecombat.com/u/itik)\
**Post date:** [December 29, 2022, 5:04pm UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541/4 "2022-12-29T17:04:25Z")

</div>

just change this and u will done  
"character == “Zozo”: "=  
character == letter:

---

<div class="post-metadata">

**Author:** ![MarmiteOnToast](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/marmiteontoast/32/46649_2.png) [@MarmiteOnToast](https://discourse.codecombat.com/u/MarmiteOnToast)\
**Post date:** [December 29, 2022, 8:44pm UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541/5 "2022-12-29T20:44:57Z")

</div>

Hi @itik, please don’t necropost. The original poster isn’t even active anymore.  
Thanks,  
Marmite

---

<div class="post-metadata">

**Author:** ![itik](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/itik/32/28431_2.png) [@itik](https://discourse.codecombat.com/u/itik)\
**Post date:** [January 3, 2023, 7:46pm UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541/6 "2023-01-03T19:46:22Z")

</div>

wat is nevcriopotst 20000000000000000000000000000000000 character

---

<div class="post-metadata">

**Author:** ![riticmaster908](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/riticmaster908/32/43503_2.png) [@riticmaster908](https://discourse.codecombat.com/u/riticmaster908)\
**Post date:** [January 3, 2023, 10:50pm UTC](https://discourse.codecombat.com/t/help-with-spy-among-us/12541/7 "2023-01-03T22:50:05Z")

</div>

necroposting is when you post something on a topic that’s either very inactive or has been solved. It’s when you post on a 2-3 year old topic when no one in the topic is active. Thanks and please don’t necropost  
-Ritic
