# A wolf in sheep's clothing

Wolves have been reintroduced to Great Britain. You are a sheep farmer, and are now plagued by wolves which pretend to be sheep. Fortunately, you are good at spotting them. 

Warn the sheep in front of the wolf that it is about to be eaten. Remember that you are standing **at the front of the queue** which is at the end of the array:

```
[sheep, sheep, sheep, sheep, sheep, wolf, sheep, sheep]      (YOU ARE HERE AT THE FRONT OF THE QUEUE)
   7      6      5      4      3            2      1
```

If the wolf is the closest animal to you, return `"Pls go away and stop eating my sheep"`. Otherwise, return `"Oi! Sheep number N! You are about to be eaten by a wolf!"` where `N` is the sheep's position in the queue.

**Note:** there will always be exactly one wolf in the array.

## Examples

```python
warn_the_sheep(["sheep", "sheep", "sheep", "wolf", "sheep"]) == 'Oi! Sheep number 1! You are about to be eaten by a wolf!'

warn_the_sheep(['sheep', 'sheep', 'wolf']) == 'Pls go away and stop eating my sheep'
```

Difficulty: introductory

Starter code:

def warn_the_sheep(queue):
	

Solutions:
def warn_the_sheep(queue):
    n = len(queue) - queue.index('wolf') - 1
    return f'Oi! Sheep number {n}! You are about to be eaten by a wolf!' if n else 'Pls go away and stop eating my sheep'


def warn_the_sheep(queue):
    i = queue[::-1].index('wolf')
    if i == 0:
        return 'Pls go away and stop eating my sheep'
    return f'Oi! Sheep number {i}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
  return 'Pls go away and stop eating my sheep' if queue[-1] == 'wolf' else f'Oi! Sheep number {queue[::-1].index("wolf")}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    queue.reverse()
    return 'Pls go away and stop eating my sheep' if queue[0] == 'wolf' else 'Oi! Sheep number {}! You are about to be eaten by a wolf!'.format(queue.index('wolf'))

def warn_the_sheep(queue):
    queue.reverse()
    return f"Oi! Sheep number {queue.index('wolf')}! You are about to be eaten by a wolf!" if queue.index('wolf') > 0 else 'Pls go away and stop eating my sheep' 

def warn_the_sheep(queue):
    wolf_positon=0 #memoy for the position of the wolf
    for postion, item in enumerate(queue): #lets check every sheep
        if item == 'wolf': #and if it is a wolf
            wolf_positon=postion+1 #we will save its position in the memory
        if wolf_positon == len(queue): #if the wolf is last
            return 'Pls go away and stop eating my sheep' #We beg the wolf. (Hell no!!!).
    #this f'{variable} some text' doesnt work in every python version(Python >= 3.6)
    #{len(queue)-wolf_positon}example: 1,2,3,4,wolf,5,6 len(queue)=7 wolf_pos=5 7-5=2
    return f'Oi! Sheep number {len(queue)-wolf_positon}! You are about to be eaten by a wolf!' 

def warn_the_sheep(queue):    
    queue.reverse()
    wolfnum = queue.index("wolf")
    if wolfnum == 0:
        return "Pls go away and stop eating my sheep"
    else:
        return "Oi! Sheep number {0}! You are about to be eaten by a wolf!".format(wolfnum)
    


def warn_the_sheep(queue):
    pos = queue[::-1].index('wolf')
    
    if pos > 0:
        return 'Oi! Sheep number %s! You are about to be eaten by a wolf!' % (pos)
    return 'Pls go away and stop eating my sheep'

def warn_the_sheep(queue):
    if queue.index('wolf') == len(queue)-1:
        return "Pls go away and stop eating my sheep"
    else:
        N = len(queue)-queue.index('wolf')-1
        return "Oi! Sheep number {0}! You are about to be eaten by a wolf!".format(N)

def warn_the_sheep(queue):
    p = queue[::-1].index("wolf")
    return f"Oi! Sheep number {p}! You are about to be eaten by a wolf!" if p!=0 else "Pls go away and stop eating my sheep"

warn_the_sheep = lambda queue: 'Oi! Sheep number ' + str(len(queue) - queue.index('wolf') - 1) + '! You are about to be eaten by a wolf!' if queue[-1] == 'sheep' else 'Pls go away and stop eating my sheep'

def warn_the_sheep(queue):
    count = 1
    wolf = 0
    for e in reversed(queue):
        count += 1
        if e == 'wolf':
            wolf = count - 2
            if wolf == 0:
                return 'Pls go away and stop eating my sheep'
    return f'Oi! Sheep number {wolf}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    if queue[-1] == 'wolf':
        return "Pls go away and stop eating my sheep"
    else:
        for i in range(len(queue)):
            if queue[len(queue)-i-1] == 'wolf':
                return "Oi! Sheep number " + str(i) + "! You are about to be eaten by a wolf!"
    


def warn_the_sheep(queue):
    index = len(queue) - queue.index("wolf") - 1
    if index == 0:
        return "Pls go away and stop eating my sheep"
    else:
        return "Oi! Sheep number " + str(index) + "! You are about to be eaten by a wolf!"

def warn_the_sheep(queue):
    wolf = queue.index('wolf')+1; length = len(queue)
    if wolf==length: return 'Pls go away and stop eating my sheep'
    else: return 'Oi! Sheep number '+str(length-wolf)+'! You are about to be eaten by a wolf!'


def warn_the_sheep(q):
    pos = len(q) - 1 - q.index('wolf')
    return 'Pls go away and stop eating my sheep' if not pos else \
           f"Oi! Sheep number {pos}! You are about to be eaten by a wolf!"

warn_the_sheep=lambda q,w='wolf':'Pls go away and stop eating my sheep'if q[-1]==w else"Oi! Sheep number {}! You are about to be eaten by a wolf!".format(len(q)-1-q.index(w))

def warn_the_sheep(queue):
    wolf_pos = queue[::-1].index("wolf")
    return ( 'Pls go away and stop eating my sheep' if wolf_pos == 0
             else 'Oi! Sheep number %s! You are about to be eaten by a wolf!' % wolf_pos )

def warn_the_sheep(queue):
    if queue[-1] == 'wolf':
        return 'Pls go away and stop eating my sheep'  
    else: 
        return 'Oi! Sheep number ' + str(len(queue) - queue.index('wolf') -1) + '! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    if queue.index('wolf') == len(queue) - 1:
        return 'Pls go away and stop eating my sheep'
    else:
        sheep = queue[::-1].index('wolf')
        return f'Oi! Sheep number {sheep}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    if (queue[-1] == 'wolf'):
        return "Pls go away and stop eating my sheep"
    else:
        queue.reverse()
        return "Oi! Sheep number "+ str(queue.index('wolf')) + "! You are about to be eaten by a wolf!"


def warn_the_sheep(queue):
    z = 0
    for i in queue:
      z+= 1
      if i == "wolf" and len(queue)-z != 0:
        return "Oi! Sheep number " + str(len(queue)-z) + "! You are about to be eaten by a wolf!"
    return "Pls go away and stop eating my sheep"

def warn_the_sheep(queue):
    queue.reverse()
    if queue.index('wolf')==0:
        return 'Pls go away and stop eating my sheep'
    else:
       return 'Oi! Sheep number {}! You are about to be eaten by a wolf!'.format(queue.index('wolf'))


from typing import List

def warn_the_sheep(queue: List[str]) -> str:
    """ Warn the sheep in front of the wolf that it is about to be eaten. """
    return "Pls go away and stop eating my sheep" if queue[-1] == "wolf" else f"Oi! Sheep number {list(reversed(queue)).index('wolf')}! You are about to be eaten by a wolf!"

def warn_the_sheep(q):   
    return ["Oi! Sheep number %s! You are about to be eaten by a wolf!" % q[::-1].index('wolf'),
            "Pls go away and stop eating my sheep"]['wolf' in q[-1]]

def warn_the_sheep(queue):   
    return ["Oi! Sheep number %s! You are about to be eaten by a wolf!" % queue[::-1].index('wolf'),
            "Pls go away and stop eating my sheep"]['wolf' in queue[-1]]

def warn_the_sheep(queue):
    queue = reverse(queue)
    message_one = 'Pls go away and stop eating my sheep'
    message_two = 'Oi! Sheep number 1! You are about to be eaten by a wolf!'
    wolf = 'wolf'
    out_count = 0
    sheep_count = 0
    queue_len = length(queue)
    wolf_len = length(wolf)
    while out_count < queue_len:
        in_count = 0
        while in_count < wolf_len:
            if queue[out_count][in_count] != wolf[in_count]:
                break
            in_count += 1
            if in_count == wolf_len - 1:
                if sheep_count == 0:
                    return message_one
                else:
                    return ('Oi! Sheep number ' + num_to_str(sheep_count) + 
                            '! You are about to be eaten by a wolf!')
        sheep_count += 1
        out_count += 1
    
def reverse(arr):
    arr_l = length(arr)
    r_arr = [0] * arr_l
    count = 0
    while count < arr_l:
        r_arr[count] = arr[arr_l - 1 - count]
        count += 1
    return r_arr
    
def length(arr):
    count = 0
    try:
        while True:
            arr[count]
            count += 1
    except:
        return count
    
def num_to_str(num):
    nums = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    str_num = ''
    while num > 0:
        str_num = nums[num % 10] + str_num
        num = (num - (num % 10)) // 10
    return str_num

def warn_the_sheep(q):
    return (f"Oi! Sheep number {q[::-1].index('wolf')}! You are about to be eaten by a wolf!", 'Pls go away and stop eating my sheep',)['w' in q[-1]]

def warn_the_sheep(queue):
    return (lambda x: f'Oi! Sheep number {x}! You are about to be eaten by a wolf!' if x \
                    else 'Pls go away and stop eating my sheep') (queue[::-1].index('wolf'))

def warn_the_sheep(queue):
    x = 0
    for i in queue:
        x = x +1
        if i == 'wolf':
            b = len(queue) - x
            if b == 0:
                return 'Pls go away and stop eating my sheep'
            else:
                return "Oi! Sheep number {}! You are about to be eaten by a wolf!".format(b)


def warn_the_sheep(queue):
    position = list(reversed(queue)).index("wolf")
    return f"Oi! Sheep number {position}! You are about to be eaten by a wolf!" if position !=0 else 'Pls go away and stop eating my sheep' 

def warn_the_sheep(queue):
    cnt = 1
    for i in range(len(queue)-1, 0, -1):
        if queue[i] == 'wolf':
            return 'Pls go away and stop eating my sheep'
        elif queue[i] == 'sheep' and queue[i-1] == 'wolf':
            return 'Oi! Sheep number {}! You are about to be eaten by a wolf!'.format(cnt)
        cnt += 1
    return 'Pls go away and stop eating my sheep'

def warn_the_sheep(queue):
    p = queue.index('wolf')
    if p == len(queue) - 1:
        return "Pls go away and stop eating my sheep"
    else:
        return "Oi! Sheep number " + str(len(queue) - 1 - p) + "! You are about to be eaten by a wolf!"

def warn_the_sheep(queue):
    return 'Pls go away and stop eating my sheep' if queue[::-1][0] == 'wolf' else f"Oi! Sheep number {queue[::-1].index('wolf')}! You are about to be eaten by a wolf!"

def warn_the_sheep(queue):
    if queue[-1] == 'wolf':
        return 'Pls go away and stop eating my sheep'
    sheep_number = len(queue) - 1 - queue.index("wolf")
    return f'Oi! Sheep number {sheep_number}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    count=0
    for i in range(len(queue)-1,-1,-1):
        if queue[i]=="wolf" and count!=0: return "Oi! Sheep number {}! You are about to be eaten by a wolf!".format(count)
        count+=1
    return "Pls go away and stop eating my sheep"

def warn_the_sheep(queue):
    if queue[-1] == 'wolf':
        return 'Pls go away and stop eating my sheep'
    position = len(queue) - queue.index('wolf') - 1
    return 'Oi! Sheep number ' + str(position) + '! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    position = 0 
    for i in range(len(queue)):
        if (queue[i]=="wolf"):
            position = len(queue)-1 -i
            break
    if (position == 0):
        return "Pls go away and stop eating my sheep"
    else:
        return "Oi! Sheep number "+str(position)+"! You are about to be eaten by a wolf!"

def warn_the_sheep(queue):
    N = queue[::-1].index("wolf")
    return "Pls go away and stop eating my sheep" if queue[-1] == "wolf" else f"Oi! Sheep number {N}! You are about to be eaten by a wolf!"

warn_the_sheep = lambda q : 'Pls go away and stop eating my sheep' if q[-1] == 'wolf' else f'Oi! Sheep number {str(q[::-1].index("wolf"))}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    queue = queue[::-1]
    
    for i in range(0,len(queue)):
        if queue[i]=="wolf":
            if i==0:
                return "Pls go away and stop eating my sheep"
            else:
                return f"Oi! Sheep number {i}! You are about to be eaten by a wolf!"
        else:
            pass

def warn_the_sheep(queue):
    wolfpos = queue.index("wolf")
    sheepeat = len(queue) - queue.index("wolf") -1
    n = str(sheepeat)
    if n == "0":
        return("Pls go away and stop eating my sheep")
    else:
        return ("Oi! Sheep number "+n+"! You are about to be eaten by a wolf!")

def warn_the_sheep(queue):
    x = len(queue)
    z = 0
    
    for k in range(0, x):
        if queue[k] == "wolf" and k < x:
            z += k
        else:
            z += 0
            
    j = x-z-1
    if z >= x and j <= 0:
        return "Pls go away and stop eating my sheep"
    elif j == 0:
        return "Pls go away and stop eating my sheep"
    else:
        return "Oi! Sheep number " + str(j) + "! You are about to be eaten by a wolf!"


def warn_the_sheep(queue):
    
    for i in range(len(queue)):
        if queue[-1] == 'wolf':
            return 'Pls go away and stop eating my sheep'
        elif queue[i] =='wolf':
            return f'Oi! Sheep number {len(queue)-1-i}! You are about to be eaten by a wolf!'


def warn_the_sheep(queue):
    wolf = len(queue) - queue.index('wolf') - 1
    
    if not wolf: return 'Pls go away and stop eating my sheep'
    
    return f'Oi! Sheep number {wolf}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    print(queue[-1])
    return ('Pls go away and stop eating my sheep', 'Oi! Sheep number {0}! You are about to be eaten by a wolf!'.format(len(queue[queue.index('wolf')::])-1))[queue[-1]=='sheep']

def warn_the_sheep(queue):
    w = queue.index('wolf') +1
    l = len(queue)
    
    if w == l:
        return 'Pls go away and stop eating my sheep'
    else:
        return f'Oi! Sheep number {l-w}! You are about to be eaten by a wolf!'

def warn_the_sheep(queue):
    db=0
    for i in range(len(queue)-1,-1,-1):
        if queue[i]=="wolf" and db==0:
            return "Pls go away and stop eating my sheep"
        elif queue[i]=="wolf" and db!=0:
            return "Oi! Sheep number "+str(db)+"! You are about to be eaten by a wolf!"
        else:
            db=db+1

def warn_the_sheep(queue):
    return 'Pls go away and stop eating my sheep' if queue.pop() == 'wolf' else f"Oi! Sheep number {int(len(queue))-int(queue.index('wolf'))}! You are about to be eaten by a wolf!"