You are working at a lower league football stadium and you've been tasked with automating the scoreboard.

The referee will shout out the score, you have already set up the voice recognition module which turns the ref's voice into a string, but the spoken score needs to be converted into a pair for the scoreboard!

e.g. `"The score is four nil"` should return `[4,0]`

Either teams score has a range of 0-9, and the ref won't say the same string every time e.g. 
      
    "new score: two three"
      
    "two two"
      
    "Arsenal just conceded another goal, two nil"
    
Note:
```python
Please return an array
```

Please rate and enjoy!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def scoreboard(string):
	

Solutions:
def scoreboard(string):
	scores = {'nil': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9}
	return [scores[x] for x in string.split() if x in scores]


PTS = {w: i for (i, w) in enumerate('nil one two three four five six seven eight nine'.split())}

def scoreboard(s):
	return [PTS[w] for w in s.split()[-2:]]


NUMBERS = 'nil one two three four five six seven eight nine'.split()

def scoreboard(s):
	return [NUMBERS.index(w) for w in s.split() if w in NUMBERS]


import re
d = {'nil': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9}

def scoreboard(string):
	x = re.findall('nil|one|two|three|four|five|six|seven|eight|nine', string)
	return [d[x[0]], d[x[1]]]


from re import findall
score = {'nil': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9}

def scoreboard(string):
	return list(map(score.get, findall('|'.join(score), string)))


def scoreboard(string):
	words = string.split()
	result = []
	numMap = ['nil', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
	for word in words:
		if word in numMap:
			result.append(numMap.index(word))
	return result


def scoreboard(string):
	scores = ['nil', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
	arr = []
	temp = -1
	num = -1
	for score in scores:
		i = string.find(score)
		if i != -1:
			if string.find(score, i + 1) != -1:
				same = scores.index(score)
				arr = [same, same]
			elif temp != -1:
				if i > temp:
					arr = [num, scores.index(score)]
				else:
					arr = [scores.index(score), num]
			else:
				temp = i
				num = scores.index(score)
	return arr


def scoreboard(string):
	data = {'nil': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9}
	return [data[word] for word in string.split() if word in data.keys()]


def scoreboard(announcement):
	numbers = {'nil': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9}
	scores = announcement.split()[-2:]
	return [numbers[score] for score in scores]


import re
scores = {word: i for (i, word) in enumerate('nil one two three four five six seven eight nine'.split())}
pattern = re.compile('\\b({})\\b'.format('|'.join(scores)))

def scoreboard(string):
	return [scores[m] for m in pattern.findall(string)]