Time to win the lottery!

Given a lottery ticket (ticket), represented by an array of 2-value arrays, you must find out if you've won the jackpot.  Example ticket:

To do this, you must first count the 'mini-wins' on your ticket.  Each sub array has both a string and a number within it. If the character code of any of the characters in the string matches the number, you get a mini win. Note you can only have one mini win per sub array.

Once you have counted all of your mini wins, compare that number to the other input provided (win). If your total is more than or equal to (win), return 'Winner!'. Else return 'Loser!'.

All inputs will be in the correct format. Strings on tickets are not always the same length.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Starter code: def bingo(ticket, win):
	

Solutions:
def bingo(ticket, win):
	return 'Winner!' if sum((chr(n) in s for (s, n) in ticket)) >= win else 'Loser!'


def bingo(ticket, win):
	return 'Winner!' if sum((w in map(ord, s) for (s, w) in ticket)) >= win else 'Loser!'


def bingo(ticket, win):
	counter = 0
	for (x, y) in ticket:
		for i in x:
			counter += 1 if ord(i) == y else 0
	return 'Loser!' if counter < win else 'Winner!'


def bingo(ticket, win):
	won = sum((chr(n) in xs for (xs, n) in ticket)) >= win
	return 'Winner!' if won else 'Loser!'


def bingo(ticket, win):
	winner = sum((1 for (stg, val) in ticket if chr(val) in stg)) >= win
	return 'Winner!' if winner else 'Loser!'


def bingo(ticket, win):
	return 'Loser!' if sum((1 if chr(i[1]) in i[0] else 0 for i in ticket)) < win else 'Winner!'


def bingo(ticket, win):
	mini_wins = sum((chr(code) in chars for (chars, code) in ticket))
	return 'Winner!' if mini_wins >= win else 'Loser!'


def bingo(ticket, win):
	mini_wins = 0
	for arr in ticket:
		mini_wins += any(map(lambda x: ord(x) == arr[1], arr[0]))
	return ['Loser!', 'Winner!'][mini_wins >= win]


def bingo(ticket, win):
	return 'WLionsneerr!!'[sum((chr(n) in s for (s, n) in ticket)) < win::2]