I will give you two strings. I want you to transform stringOne into stringTwo one letter at a time.

Example:

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def mutate_my_strings(s1,s2):
	

Solutions:
def mutate_my_strings(s1, s2):
	return '\n'.join([s1] + [s2[:i] + s1[i:] for (i, (a, b)) in enumerate(zip(s1, s2), 1) if a != b]) + '\n'


def mutate_my_strings(s1, s2):
	result = [s1]
	result.extend((f'{s2[:i + 1]}{s1[i + 1:]}' for i in range(len(s1)) if s1[i] != s2[i]))
	result.append('')
	return '\n'.join(result)


def mutate_my_strings(s1, s2):
	res = [s1]
	s1 = list(s1)
	s2 = list(s2)
	for (i, x) in enumerate(s1):
		if s1[i] != s2[i]:
			s1[i] = s2[i]
			res.append(''.join(s1))
	return '\n'.join(res) + '\n'


def mutate_my_strings(s1, s2):
	s = s1 + '\n'
	s1 = list(s1)
	s2 = list(s2)
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			s1[i] = s2[i]
			s += ''.join(s1) + '\n'
	return s


def mutate_my_strings(s1, s2):
	return '\n'.join([s2[:i] + s1[i:] for i in range(0, len(s1)) if s1[i] != s2[i]] + [s2]) + '\n'


from collections import OrderedDict

def mutate_my_strings(s1, s2):
	return '\n'.join(OrderedDict.fromkeys((s2[:i] + s1[i:] for i in range(len(s1) + 1)))) + '\n'


def mutate_my_strings(s1, s2):
	if s1 == s2:
		return f'{s1}\n'
	return f'{s1}\n' + '\n'.join((f'{s2[:i + 1]}{s1[i + 1:]}' for i in range(len(s1)) if s1[i] != s2[i])) + '\n'


def mutate_my_strings(s1, s2):
	l = len(s2)
	return '\n'.join((s2[:i] + s1[i:] for i in range(l + 1) if i == l or s2[i] != s1[i])) + '\n'


def mutate_my_strings(s1, s2):
	return s1 + '\n' + '\n'.join((s2[:i + 1] + s1[i + 1:] for i in range(len(s1)) if s1[i] != s2[i])) + '\n' if s1 and s1 != s2 else s1 + '\n'


def mutate_my_strings(s1, s2):
	return '\n'.join((s2[:a] + s1[a:] for a in range(len(s1)) if s2[a] != s1[a])) + '\n' + s2 + '\n' if s1 != s2 else s1 + '\n'