Question::
Write a program that maps a list of words into a list of integers representing the lengths of the corresponding words.
Code::
def mapping(l):
mapped=[]
for j in l:
mapped.append(len(j))
return mapped
n=input("Enter words:")
nt=n.split(",")
mapped=mapping(nt)
print("Another List:",mapped)
Output::
Write a program that maps a list of words into a list of integers representing the lengths of the corresponding words.
Code::
def mapping(l):
mapped=[]
for j in l:
mapped.append(len(j))
return mapped
n=input("Enter words:")
nt=n.split(",")
mapped=mapping(nt)
print("Another List:",mapped)
Output::