To celebrate the start of the Rio Olympics (and the return of 'the Last Leg' on C4 tonight) this is an Olympic inspired kata.

Given a string of random letters, you need to examine each. Some letters naturally have 'rings' in them. 'O' is an obvious example, but 'b', 'p', 'e', 'A', etc are all just as applicable. 'B' even has two!! Please note for this kata you can count lower case 'g' as only one ring.

Your job is to count the 'rings' in each letter and divide the total number by 2. Round the answer down. Once you have your final score:

if score is 1 or less,  return 'Not even a medal!';
if score is 2, return 'Bronze!';
if score is 3, return 'Silver!';
if score is more than 3, return 'Gold!';

Dots over i's and any other letters don't count as rings.

Difficulty: EASY
Starter code: def olympic_ring(string):
	

Solutions:
def olympic_ring(string):
	return (['Not even a medal!'] * 2 + ['Bronze!', 'Silver!', 'Gold!'])[min(4, sum(map('abdegopqABBDOPQR'.count, string)) // 2)]


def olympic_ring(string):
	rings = string.translate(str.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', '1201000000000011110000000011011010000000111000000000'))
	score = sum(map(int, rings)) // 2
	return ['Not even a medal!', 'Bronze!', 'Silver!', 'Gold!'][(score > 1) + (score > 2) + (score > 3)]


def olympic_ring(string):
	h = {'a': 1, 'b': 1, 'd': 1, 'e': 1, 'g': 1, 'o': 1, 'p': 1, 'q': 1, 'A': 1, 'B': 2, 'D': 1, 'O': 1, 'P': 1, 'R': 1, 'Q': 1}
	result = lambda i: {i <= 1: 'Not even a medal!', i == 2: 'Bronze!', i == 3: 'Silver!', i >= 4: 'Gold!'}[True]
	return result(sum([h[i] if i in h.keys() else 0 for i in string]) // 2)


def olympic_ring(string):
	score = (sum((c in 'abdegopqABDOPQR' for c in string)) + string.count('B')) // 2
	return next((medal for (min_score, medal) in ((4, 'Gold!'), (3, 'Silver!'), (2, 'Bronze!'), (0, 'Not even a medal!')) if score >= min_score))


def olympic_ring(string):
	n = sum((string.count(c) for c in 'ADOPQRabdegopq')) + string.count('B') * 2
	return ['Not even a medal!', 'Bronze!', 'Silver!', 'Gold!'][max(min(int(n / 2) - 1, 3), 0)]


ring = 'abdegopqADOPQR'

def olympic_ring(stg):
	score = sum((1 if c in ring else 2 if c == 'B' else 0 for c in stg)) // 2
	return 'Gold!' if score > 3 else 'Silver!' if score > 2 else 'Bronze!' if score > 1 else 'Not even a medal!'


def olympic_ring(string):
	s = sum((2 if c == 'B' else 1 if c in 'abdegopqADOPQR' else 0 for c in string)) // 2
	return 'Not even a medal!' if s <= 1 else 'Bronze!' if s == 2 else 'Silver!' if s == 3 else 'Gold!'


rings = dict(dict.fromkeys('B', 2), **dict.fromkeys('ADOPRQaobdpqeg', 1))

def olympic_ring(s):
	score = sum((rings.get(c, 0) for c in s)) // 2
	return 'Not even a medal!' if score <= 1 else 'Bronze!' if score == 2 else 'Silver!' if score == 3 else 'Gold!'


def olympic_ring(string):
	rings = 'abdegopqADOPQRBB'
	count = sum((string.count(c) for c in rings)) // 2
	if count <= 1:
		return 'Not even a medal!'
	if count == 2:
		return 'Bronze!'
	if count == 3:
		return 'Silver!'
	return 'Gold!'


one = 'abdegopqADOPQR'
import math

def olympic_ring(string):
	c = 0
	for x in string:
		if x == 'B':
			c = c + 2
		if x in one:
			c = c + 1
	c = math.floor(c / 2)
	if c > 3:
		return 'Gold!'
	if c == 3:
		return 'Silver!'
	if c == 2:
		return 'Bronze!'
	return 'Not even a medal!'