"The Shell Game" involves cups upturned on a playing surface, with a ball placed underneath one of them.  The index of the cups are swapped around multiple times. After that the players will try to find which cup contains the ball.

Your task is as follows.  Given the cup that the ball starts under, and list of swaps, return the location of the ball at the end.  Cups are given like array/list indices.

For example, given the starting position `0` and the swaps `[(0, 1), (1, 2), (1, 0)]`:

 * The first swap moves the ball from `0` to `1`
 * The second swap moves the ball from `1` to `2`
 * The final swap doesn't affect the position of the ball.
 
 So

```python
find_the_ball(0, [(0, 1), (2, 1), (0, 1)]) == 2
```

There aren't necessarily only three cups in this game, but there will be at least two.  You can assume all swaps are valid, and involve two distinct indices.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def find_the_ball(start, swaps):
	

Solutions:
def find_the_ball(start, swaps):
	pos = start
	for (a, b) in swaps:
		if a == pos:
			pos = b
		elif b == pos:
			pos = a
	return pos


def find_the_ball(start, swaps):
	for sw in swaps:
		if start in sw:
			start = sw[1 - sw.index(start)]
	return start


def find_the_ball(start, swaps):
	ball = start
	for (a, b) in swaps:
		if ball == a:
			ball = b
		elif ball == b:
			ball = a
	return ball


def find_the_ball(start, swaps):
	pos = start
	for tup in swaps:
		if pos == tup[0]:
			pos = tup[1]
		elif pos == tup[1]:
			pos = tup[0]
	return pos


def find_the_ball(start, swaps):
	arr = [0] * 100000
	arr[start] = 1
	for (x, y) in swaps:
		(arr[x], arr[y]) = (arr[y], arr[x])
	return arr.index(1)


def find_the_ball(pos, swaps):
	for swap in swaps:
		if pos in swap:
			pos = swap[1 - swap.index(pos)]
	return pos


def find_the_ball(pos, swaps):
	for (a, b) in swaps:
		pos = a if pos == b else b if pos == a else pos
	return pos


def find_the_ball(k, li):
	for i in li:
		if k in i:
			k = [i[0], i[1]][i[0] == k]
	return k