92,289 views
28 votes
28 votes
Write a function named add_surname that takes as a parameter a list of first names. It should use a list comprehension to return a list that contains only those names

User Sgoettschkes
by
2.8k points

1 Answer

16 votes
16 votes

def accumulating():

List = []

Strings = input("Please enter a list of strings: ")

List = Strings.split(" ")

return List

def length(n):

r = []

for i in n:

r.append(len(n))

return r

def main():

y = accumulating()

x = length(y)

print(x)

main()

User Leri Gogsadze
by
3.1k points