Codewars
8 kyu Add Length
https://www.codewars.com/kata/559d2284b5bb6799e9000047/train/python
What if we need the length of the words separated by a space to be added at the end of that same word and have it returned as an array?
verbalization
Split words with space. (use .split(“ ”))
Count each length of words. (use len())
Add 2. after each words. (use append)
Code
def add_length(str_):
w = str_.split(" ")
n = []
for i in w:
l = i + " " + str(len(i))
n.append(l)
return n