You will be given two ASCII strings, `a` and `b`. Your task is write a function to determine which one of these strings is "worth" more, and return it.

A string's worth is determined by the sum of its ASCII codepoint indexes. So, for example, the string `HELLO` has a value of 372: H is codepoint 72, E 69, L 76, and O is 79. The sum of these values is 372.

In the event of a tie, you should return the first string, i.e. `a`.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def highest_value(a, b):
	

Solutions:
def highest_value(a, b):
	return max(a, b, key=lambda s: sum(map(ord, s)))


def highest_value(a, b):
	return a if sum(map(ord, a)) >= sum(map(ord, b)) else b


def highest_value(a, b):
	return b if sum((ord(x) for x in b)) > sum((ord(x) for x in a)) else a


def worth(s):
	return sum(map(ord, s))

def highest_value(a, b):
	return max(a, b, key=worth)


def highest_value(*args):
	return max(args, key=lambda s: sum(map(ord, s)))


def highest_value(a, b):
	return max(a, b, key=lambda stg: sum((ord(char) for char in stg)))


def highest_value(a, b):
	ascii_values_a = [ord(c) for c in a]
	ascii_values_b = [ord(c) for c in b]
	if sum(ascii_values_a) > sum(ascii_values_b) or sum(ascii_values_a) == sum(ascii_values_b):
		return a
	return b


def highest_value(a, b):
	return [a, b][sum(map(ord, a)) < sum(map(ord, b))]


def highest_value(*args):
	return max(args, key=lambda a: sum((ord(b) for b in a)))


def highest_value(a, b):
	return a if sum((ord(c) for c in a)) >= sum((ord(c) for c in b)) else b