You probably know the 42 number as "The answer to life, the universe and everything" according to Douglas Adams' "The Hitchhiker's Guide to the Galaxy". For Freud, the answer was quite different.

In the society he lived in, people-women in particular- had to repress their sexual needs and desires. This was simply how the society was at the time. 
Freud then wanted to study the illnesses created by this, and so he digged to the root of their desires. This led to some of the most important psychoanalytic theories to this day, Freud being the father of psychoanalysis.

Now, basically, when a person hears about Freud, s/he hears "sex" because for Freud, everything was basically related to, and explained by sex. 

In this kata, the toFreud() function will take a string as its argument, and return a string with every word replaced by the explanation to everything, according to Freud. Note that an empty string, or no arguments, should result in the ouput being ""(empty string).

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def to_freud(sentence):
	

Solutions:
def to_freud(sentence):
	return ' '.join(('sex' for _ in sentence.split()))


def to_freud(s):
	return (len(s.split()) * 'sex ').strip()


def to_freud(sentence):
	words = sentence.split()
	wordcount = len(words)
	print(wordcount)
	s = ''
	while wordcount > 0:
		s = s + 'sex '
		wordcount -= 1
	return s[:-1]


def to_freud(sentence):
	import re
	return re.sub('\\S+', 'sex', sentence)


def to_freud(sentence):
	word = sentence.split()
	a = len(word)
	print(a)
	s = ''
	while a > 0:
		s = s + 'sex '
		a -= 1
	return s[:-1]


def to_freud(sentence):
	sentence = sentence.split()
	sentence = ['sex' for i in range(len(sentence))]
	sentence = ' '.join(sentence)
	return sentence


def to_freud(s):
	return ' '.join(('sex' for _ in s.split()))


def to_freud(sentence):
	return ' '.join(['sex'] * len(sentence.split(' ')))


def to_freud(sentence):
	return ' '.join(('sex' for i in sentence.split()))


to_freud = __import__('functools').partial(__import__('re').compile('\\S+').sub, 'sex')


to_freud = lambda s: ('sex ' * len(s.split()))[:-1]


to_freud = lambda s: ' '.join(['sex'] * len(s.split()))


def to_freud(sentence):
	n = sentence.count(' ')
	s = 'sex'
	for i in range(0, n):
		s += ' sex'
	return s


def to_freud(sentence):
	return (len(sentence.split()) * 'sex ').strip()


from re import sub

def to_freud(sentence: str) -> str:
	return sub("\\b[\\w\\'']+\\b", 'sex', sentence)


to_freud = lambda s: (' sex' * -~s.count(' '))[1:]


def to_freud(sentence):
	return ('sex ' * len(sentence.split())).rstrip()


def to_freud(sentence):
	wordCount = len(sentence.split(' '))
	list = ['sex'] * wordCount
	return ' '.join(list)


to_freud = lambda sentence: ' '.join(map(lambda x: 'sex', sentence.split(' ')))


def to_freud(sentence):
	return ' '.join(__import__('itertools').repeat('sex', len(sentence.split())))


def to_freud(sentence):
	return ('sex ' * len(sentence.split()))[:-1]


def to_freud(sentence):
	return ' '.join(['sex' if len(sentence) > 1 else '' for i in sentence.split()])


def to_freud(sentence):
	return ' '.join(('sex' for x in sentence.split()))


def to_freud(s):
	return ' '.join(map(lambda x: 'sex', s.split()))


def to_freud(sentence):
	i = 0
	for x in sentence.split():
		i += 1
	return (i * 'sex ').strip()


from re import sub

def to_freud(sentence: str) -> str:
	return sub('\\S+', 'sex', sentence)


def to_freud(sentence):
	return ' '.join((word.replace(word, 'sex') for word in sentence.split(' ')))


def to_freud(s):
	return ' '.join(('sex' for _ in range(len(s.split()))))


def to_freud(sentence):
	return ' '.join((sentence.count(' ') + 1) * ['sex']) if sentence else ''


def to_freud(s):
	l = s.split(' ')
	return ' '.join(('sex' for i in l))


def to_freud(sentence):
	a = sentence.split(' ')
	b = 'sex ' * len(a)
	return b.strip()


def to_freud(sentence):
	x = sentence.split()
	new = 'sex'
	for y in range(len(x) - 1):
		new = new + ' ' + 'sex'
	return new


def to_freud(sentence):
	result = ''
	for i in sentence.split(' '):
		result += 'sex '
	return result.rstrip(' ')


def to_freud(sentence):
	sentence = sentence.split()
	a = ''
	for el in sentence:
		el = 'sex'
		a += el + ' '
	return a[:-1]


def to_freud(sen):
	return ' '.join(['sex' for i in range(len(sen.split(' ')))])


def to_freud(sentence):
	res = ''
	my_list = sentence.split(' ')
	for i in range(len(my_list)):
		res += 'sex '
	return res[:-1]


def to_freud(sentence):
	result = ''
	new_sentence = sentence.split(' ')
	for word in range(len(new_sentence)):
		new_sentence[word] = 'sex'
		result += new_sentence[word] + ' '
	return result[:-1]


def to_freud(sentence):
	ss = sentence.split()
	sex = []
	for i in range(len(ss)):
		sex.append('sex')
	a = ' '.join(sex)
	return a


def to_freud(sentence):
	l = len(sentence.split(' '))
	return ' '.join(['sex' for _ in range(l)])


def to_freud(sentence):
	a = sentence.split(' ')
	b = ''
	for i in a:
		if not b:
			b += 'sex '
		else:
			b += 'sex '
	if b[-1] == ' ':
		return b[:-1]
	else:
		return b


def to_freud(sentence):
	return '' if sentence == '' else 'sex ' * (len(sentence.split()) - 1) + 'sex'


def to_freud(sentence):
	l = sentence.split()
	s = ['sex'] * len(l)
	return ' '.join(s)


def to_freud(sentence):
	sent = sentence.split()
	ans = ''
	for i in sent:
		ans = ans + 'sex '
	return ans[:len(ans) - 1]


def to_freud(sentence):
	try:
		res = []
		for i in range(len(sentence.split())):
			res.append('sex')
		return ' '.join(res)
	except:
		return ''


def to_freud(sentence):
	if sentence is not None:
		return ' '.join(map(lambda x: 'sex', sentence.split(' ')))
	return ''


def to_freud(sentence):
	x = sentence.split()
	sum = ''
	for y in x:
		sum += 'sex '
	return sum.rstrip(' ')


def to_freud(sentence):
	return ' '.join(('sex' for el in sentence.split(' ')))


def to_freud(sentence):
	count = len(sentence.split())
	s = 'sex ' * count
	return s[:-1]


def to_freud(sentence):
	sentence = sentence.split(' ')
	a = len(sentence)
	b = a - 1
	return b * 'sex ' + 'sex'


def to_freud(sentence):
	answer = []
	string = sentence.split()
	for word in string:
		x = word.replace(word, 'sex')
		answer.append(x)
	return ' '.join(answer)


to_freud = lambda sentence: ' '.join(('sex' for i in sentence.split()))


def to_freud(sentence):
	words = sentence.split(' ')
	made_string = str(''.join('sex ' * len(words)))
	return made_string.rstrip()


def to_freud(sentence):
	result = ''
	for i in range(len(sentence.split(' '))):
		result += 'sex '
	return result[:-1]


def to_freud(sentence):
	if sentence == '':
		return ''
	lista = sentence.split(' ')
	output = 'sex ' * len(lista)
	return output[:-1]


def to_freud(sentence):
	return ' '.join(['sex' for elem in sentence.split()])


def to_freud(sentence):
	if len(sentence):
		a = sentence.count(' ') + 1
		return ('sex ' * a).strip()
	else:
		return ''


to_freud = lambda s: ('sex ' * len(s.split())).rstrip()


def to_freud(sentence):
	return ' '.join(['sex' for i in range(sentence.count(' ') + 1)])


def to_freud(sentence):
	s = sentence.count(' ')
	d = 'sex ' * s + 'sex'
	return d


def to_freud(x):
	s = x.split()
	d = ['sex ' * len(s)]
	return x if x == '' else ' '.join(d)[:-1]


def to_freud(sentence):
	word = ' sex'
	if sentence.count(' ') == 0:
		return 'sex'
	elif sentence.count(' ') >= 1:
		return 'sex' + word * sentence.count(' ')


def to_freud(sentence):
	return '' if not sentence else ' '.join(('sex' for elem in sentence.split() if elem.isalpha() or "'" in elem))


def to_freud(sentence):
	if not sentence:
		return ''
	return ' '.join(len(sentence.split(' ')) * ['sex'])


def to_freud(sentence):
	array = []
	for word in sentence.split(' '):
		array.append('sex')
	return ' '.join(array)


def to_freud(sentence):
	res = ['sex']
	a = list(sentence).count(' ')
	for i in range(a):
		res.append('sex')
	return ' '.join(res)


def to_freud(sentence):
	new2 = ''
	for each in range(len(sentence.split())):
		new2 += 'sex '
	return new2.rstrip()


def to_freud(s):
	return (len(s.split()) * ' sex ')[1:-1].replace('  ', ' ')


def to_freud(sentence):
	return ' '.join(('sex' for x in range(len(sentence.split()))))