return string length

Question

Return string length of all the strings in [“Spain”, “Mykonos”, “Nice”, “New York”] without using a for loop.

in progress 0
YashikaKhurana 55 years 3 Answers 831 views Master 0

Answers ( 3 )

  1. def findLen(a):
    return len(a)

    ans=map(findLen, (“Spain”, “Mykonos”, “Nice”, “New York”))

  2. k = [“Spain”, “Mykonos”, “Nice”, “New York”]

    for i in k:
    print(len(i))

  3. s=[“Spain”,” Mykonos”, “Nice”, “New York “]
    list(map(lambda x:len(x),s))

Leave an answer

Browse
Browse