Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

reverse every word from a sentence but maintain position

def reverse_words(text):
  #go for it
    words = text.split(" ")
    new_words = [word[::-1] for word in words]
    new_sentence = " ".join(new_words)
    return new_sentence
Source by www.codewars.com #
 
PREVIOUS NEXT
Tagged: #reverse #word #sentence #maintain #position
ADD COMMENT
Topic
Name
2+9 =