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).

Difficulty: introductory

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):
    words = sentence.split()
    wordcount = len(words)
    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):
    word = sentence.split()
    wordcount = len(word)
    print(wordcount)
    s = ""
    while wordcount > 0:
        s = s + "sex "
        wordcount -= 1
    return s[:-1]

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

def to_freud(sentence):
    words = sentence.split()
    wordcount = len(words)
    s = ""
    while wordcount > 0:
        s += "sex "
        wordcount -= 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(r"\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()
    #your code here


from re import sub

def to_freud(sentence: str) -> str:
    """ Replace every word in the sentece by `sex`. """
    return sub(r"\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):
  #your code here
  return ("sex " * len(sentence.split(' '))).strip()

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' for i in range(len(sentence.split(' '))))

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):
  #your code here
    return ' '.join("sex" for x in sentence.split(" " or ","))

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

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


from re import sub

def to_freud(sentence: str) -> str:
    """ Replace every word in the sentece by `sex`. """
    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):
  #your code here
    return ' '.join([ i.replace(i, 'sex') for i in sentence.split(' ')])


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

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

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

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):
    arr=sentence.split(" ")
    for i in range(0,len(arr)):
        arr[i]="sex"
    return " ".join(arr)

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(' ')
    #return ["sex" for i in sentence.split(' ')]


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):
    return (len(sentence.split()) * 'sex ' if sentence else '')[:-1]

def to_freud(sentence):
    n = len(sentence.split(" "))
    return ("sex "*n).strip(" ")

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):
    msg = ' '.join('sex' for _ in sentence.split())
    return msg

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

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

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

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):
    list = sentence.split(' ')
    return ' '.join(['sex' for i in range(len(list))])

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

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

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

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

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

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

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):
  sentence = ['sex' for word in sentence.split(' ')]
  return ' '.join(sentence)

def to_freud(sentence):
    ctr = 0
    try:
        cunt = sentence.split()
        for fuck in cunt:
            cunt[ctr] = "sex"
            ctr += 1
        return ' '.join(cunt)
    except:
        "(empty string)"

def to_freud(sentence: str) -> str:
    return ' '.join("sex" for _ in sentence.split())


def to_freud(sentence):
  return ' '.join('sex' for i in range(1, len(sentence.split(' '))+1))

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)
  #your code here


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):
    a = sentence.split(" ")
    return (len(a) - 1) * "sex " + "sex"

def to_freud(sentence):
    res = ["sex"]
    a = list(sentence).count(" ")
    for i in range(a):
        res.append("sex")
    return " ".join(res)
  #your code here


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


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


def to_freud(sentence):
  #your code here
  a = ''
  for i in range(len(sentence.split())):
      a += 'sex '
  return a[:-1]

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

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


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())))

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