Our football team finished the championship.
The result of each match look like "x:y". Results of all matches are recorded in the collection.

For example:
```["3:1", "2:2", "0:1", ...]```

Write a function that takes such collection and counts the points of our team in the championship.
Rules for counting points for each match:
- if x>y - 3 points
- if x<y - 0 point
- if x=y - 1 point

Notes:
- there are 10 matches in the championship
- 0 <= x <= 4
- 0 <= y <= 4

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Starter code: def points(games):
	

Solutions:
def points(games):
	count = 0
	for score in games:
		res = score.split(':')
		if res[0] > res[1]:
			count += 3
		elif res[0] == res[1]:
			count += 1
	return count


def points(a):
	return sum(((x >= y) + 2 * (x > y) for (x, y) in (s.split(':') for s in a)))


def points(games):
	count = 0
	for match in games:
		x = match.split(':')
		if x[0] > x[1]:
			count += 3
		elif x[0] == x[1]:
			count += 1
	return count


def points(games):
	return sum(([0, 1, 3][1 + (g[0] > g[2]) - (g[0] < g[2])] for g in games))


def points(games):
	return sum((3 if x > y else 0 if x < y else 1 for (x, y) in (score.split(':') for score in games)))


def points(games):
	result = 0
	for item in games:
		result += 3 if item[0] > item[2] else 0
		result += 1 if item[0] == item[2] else 0
	return result


points = lambda g: sum(((x > y) * 3 or x == y for (x, _, y) in g))


def points(games):
	sum = 0
	for g in games:
		s = g.split(':')
		if s[0] > s[1]:
			sum += 3
		elif s[0] == s[1]:
			sum += 1
	return sum


def points(games):

	def convert(game):
		(x, y) = (int(game[0]), int(game[2]))
		return 3 if x > y else 1 if x == y else 0
	return sum((convert(game) for game in games))


def points(games):
	total = 0
	a = len(games)
	for i in range(0, a):
		a = games[i].split(':')
		if a[0] > a[1]:
			total = total + 3
		if a[0] == a[1]:
			total = total + 1
		if a[0] < a[1]:
			total = total + 0
	return total


def points(games):

	def score(x):
		if x[0] > x[2]:
			return 3
		elif x[0] < x[2]:
			return 0
		else:
			return 1
	return sum((score(x) for x in games))


def score_game(x, y):
	if x > y:
		return 3
	if x < y:
		return 0
	return 1

def points(games):
	return sum((score_game(*game.split(':')) for game in games))


def points(games):
	return sum((3 * (x > y) + (x == y) for (x, _, y) in games))


def points(arr):
	L = []
	for i in arr:
		L1 = i.split(':')
		if L1[0] > L1[1]:
			L.append(3)
		elif L1[0] < L1[1]:
			L.append(0)
		elif L1[0] == L1[1]:
			L.append(1)
	return sum(L)


def points(games):
	points = 0
	for i in range(len(games)):
		match = games[i]
		x = match[0]
		y = match[2]
		if x > y:
			points += 3
		elif x == y:
			points += 1
	return points
points(['1:0', '2:0', '3:0', '4:0', '2:1', '3:1', '4:1', '3:2', '4:2', '4:3'])


def points(games):
	points = 0
	for game in games:
		x = int(game[0])
		y = int(game[2])
		if x > y:
			points += 3
		elif x == y:
			points += 1
	return points


def points(games):
	points = 0
	for i in range(len(games)):
		if games[i][0] > games[i][2]:
			points += 3
		elif games[i][0] == games[i][2]:
			points += 1
	return points


def points(games):
	l = []
	x = 0
	z = 0
	n = ' '.join(games)
	for i in n:
		if i != ' ' and i != ':':
			l.append(i)
			x += 1
			if x == 2:
				if int(l[0]) > int(l[1]):
					z += 3
				elif int(l[0]) < int(l[1]):
					z += 0
				else:
					z += 1
				l.clear()
				x -= 2
	return z


def points(games):
	(pnts, lst) = (0, [i for i in games])
	for j in range(len(lst)):
		if lst[j][0] > lst[j][2]:
			pnts += 3
		if lst[j][0] == lst[j][2]:
			pnts += 1
	return pnts


points = lambda Q: sum((3 * (V[0] > V[2]) + (V[0] == V[2]) for V in Q))


points = lambda c: sum((3 * (h > g) + (h == g) for (h, _, g) in c))


def points(games):
	points = 0
	for a in games:
		if a[0] > a[2]:
			points += 3
		elif a[0] == a[2]:
			points += 1
	return points


def points(games):
	count = 0
	for i in games:
		if int(i[0]) > int(i[2]):
			count += 3
		elif int(i[0]) == int(i[2]):
			count += 1
	return count


def points(games):
	pts = 0
	for i in games:
		if i[0] > i[2]:
			pts += 3
		elif i[0] == i[2]:
			pts += 1
	return pts


points = lambda games: sum([3 if g[0] > g[-1] else 1 if g[0] == g[-1] else 0 for g in games])


def points(games):
	return sum(((x >= y) * (1 + 2 * (x > y)) for (x, y) in map(lambda s: s.split(':'), games)))


def points(games):
	diff = map(lambda x: int(x[0]) - int(x[-1]), games)
	wins = map(lambda x: 3 if x > 0 else x, diff)
	return sum(list(map(lambda x: 1 if x == 0 else x * (x > 0), wins)))


def points(games):
	points = 0
	for game in games:
		(x, y) = game.split(':')
		points += [0, 1, 3][(x >= y) + (x > y)]
	return points


from typing import List

def points(games: List[str]) -> int:
	points = 0
	results = [(int(goals[0]), int(goals[1])) for goals in [score.split(':') for score in games]]
	for (scored_goals, lost_goals) in results:
		if scored_goals > lost_goals:
			points += 3
		elif scored_goals == lost_goals:
			points += 1
	return points


def points(games):
	final = 0
	for score in games:
		(x, y) = score.split(':')
		if x > y:
			final += 3
		elif x == y:
			final += 1
		else:
			final + 0
	return final


def points(games):

	def calculate(args):
		return 0 if args[1] > args[0] else 1 if args[1] == args[0] else 3
	return sum([calculate(scores.split(':')) for scores in games])


def points(games):
	p = 0
	for game in games:
		(x, y) = game.split(':')
		p += 3 if x > y else 0 if x < y else 1
	return p


def points(game_results):
	return sum((get_points(result) for result in game_results))

def get_points(result):
	left_score = int(result[0])
	right_score = int(result[-1])
	if left_score > right_score:
		return 3
	elif left_score < right_score:
		return 0
	elif left_score == right_score:
		return 1


def points(games):
	sumx = 0
	for x in games:
		temp = x.split(':')
		if temp[0] == temp[1]:
			sumx += 1
		elif temp[0] > temp[1]:
			sumx += 3
	return sumx


points = lambda games: sum(map(lambda p: 3 if p[0] > p[2] else 1 if p[0] == p[2] else 0, games))


import re

def points(games):
	match = re.findall('[0-9]', ''.join(games))
	p = 0
	for i in range(0, len(match), 2):
		if ord(match[i]) > ord(match[i + 1]):
			p += 3
		elif ord(match[i]) == ord(match[i + 1]):
			p += 1
	return p


def points(games):
	total_pts = 0
	for game in games:
		(x, y) = game.split(':')
		if x == y:
			total_pts += 1
		elif x > y:
			total_pts += 3
	return total_pts


def points(scores):
	return sum([3 if s[0] > s[2] else 1 for s in scores if s[0] >= s[2]])


def points(games):
	total = 0
	for (x, _, y) in games:
		if x > y:
			total += 3
		elif x == y:
			total += 1
	return total


def points(games):
	res = 0
	for e in games:
		if e.split(':')[0] > e.split(':')[1]:
			res += 3
		elif e.split(':')[0] == e.split(':')[1]:
			res += 1
	return res


def points(games):
	point = 0
	for i in games:
		b = i.split(':')
		if int(b[0]) > int(b[1]):
			point += 3
		elif int(b[0]) < int(b[1]):
			point += 0
		elif int(b[0]) == int(b[1]):
			point += 1
	return point


def points(games):
	g = 0
	for i in games:
		j = i.split(':')
		if j[0] > j[1]:
			g += 3
		elif j[0] == j[1]:
			g += 1
	return g


def points(games):
	score = 0
	for x in games:
		if x[0] > x[2]:
			score += 3
		if x[0] == x[2]:
			score += 1
	print(score)
	return score


def points(games):
	points_res = 0
	for res_str in games:
		x = int(res_str[0])
		y = int(res_str[2])
		if x > y:
			points_res += 3
		elif x == y:
			points_res += 1
	return points_res


def points(games):
	if not games:
		return 0
	x = games[0]
	if int(x[0]) > int(x[2]):
		return 3 + points(games[1:])
	if x[0] == x[2]:
		return 1 + points(games[1:])
	return 0 + points(games[1:])


def points(games):
	result = 0
	for score in games:
		(x, y) = score.split(':')
		if x > y:
			result += 3
		if x == y:
			result += 1
	return result


def points(games):
	score = 0
	for game in games:
		(x, y) = tuple(game.split(':'))
		if x > y:
			score += 3
		elif x == y:
			score += 1
	return score


def points(games):
	si = 0
	si = sum((3 if match[0] > match[2] else 1 if match[0] == match[2] else 0 for match in games))
	return si


def points(games):
	points = 0
	for game in games:
		point = list(map(int, game.split(':')))
		if point[0] > point[1]:
			points += 3
		elif point[0] == point[1]:
			points += 1
	return points


def points(games):
	count = 0
	for i in games:
		(a, b) = i.split(':')
		if a > b:
			count += 3
		elif a == b:
			count += 1
		else:
			continue
	return count


def points(games):
	our_points = 0
	for game in games:
		if game[0] > game[2]:
			our_points = our_points + 3
		elif game[0] == game[2]:
			our_points = our_points + 1
		else:
			pass
	return our_points


def points(games):
	points = 0
	for game in games:
		score = game.split(':')
		if score[0] > score[1]:
			points += 3
		elif score[0] == score[1]:
			points += 1
	return points


def points(games):
	point = 0
	for score in games:
		(x, y) = map(int, score.split(':'))
		if x > y:
			point += 3
		elif x == y:
			point += 1
	return point