Help Johnny!
He can't make his code work!
Easy Code
Johnny is trying to make a function that adds the sum of two encoded strings, but he can't find the error in his code! Help him!

Source: codewars | Difficulty: EASY
Tags: String algorithms

Mathematics

Starter code: def add(s1, s2):
	

Solutions:
def add(s1, s2):
	return sum((ord(x) for x in s1 + s2))


def add(s1, s2):
	s1 = s1.encode()
	s2 = s2.encode()
	return sum(s1 + s2)


def add(s1, s2):
	return sum(map(ord, s1 + s2))


def add(s1, s2):
	return sum([ord(i) for i in s1 + s2])


def add(s1, s2):
	char_sum = lambda x: sum(map(ord, x))
	return char_sum(s1) + char_sum(s2)


def add(s1, s2):
	count = 0
	for i in range(len(s1) + len(s2)):
		if i < len(s1):
			count += ord(s1[i])
		if i < len(s2):
			count += ord(s2[i])
	return count


add = lambda a, b: sum(map(ord, a + b))


def add(s1, s2):
	return sum([ord(s) for s in s1]) + sum([ord(s) for s in s2])