# 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: EASY
Tags: Fundamentals

Data structures
Skill types: Data structures

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):
	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):
	wolf_positon = 0
	for (postion, item) in enumerate(queue):
		if item == 'wolf':
			wolf_positon = postion + 1
		if wolf_positon == len(queue):
			return 'Pls go away and stop eating my sheep'
	return f'Oi! Sheep number {len(queue) - wolf_positon}! You are about to be eaten by a wolf!'


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!'


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


from typing import List

def warn_the_sheep(queue: List[str]) -> str:
	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):
	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(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):
	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):
	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):
	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']