Share
return string length
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Return string length of all the strings in [“Spain”, “Mykonos”, “Nice”, “New York”] without using a for loop.
Answers ( 3 )
def findLen(a):
return len(a)
ans=map(findLen, (“Spain”, “Mykonos”, “Nice”, “New York”))
k = [“Spain”, “Mykonos”, “Nice”, “New York”]
for i in k:
print(len(i))
s=[“Spain”,” Mykonos”, “Nice”, “New York “]
list(map(lambda x:len(x),s))