How to get the length of each word in the tuple with Python

1 Answer

0 votes
def words_len(word):
    return len(word)

map_object = map(words_len, ('python', 'c', 'c++', "java"))

print(list(map_object))


'''
run:

[6, 1, 3, 4]

'''

 



answered Dec 13, 2018 by avibootz
...