मराठी

Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple containing length of each word of a string.For example, if the string is "Come let us have some fun"

Advertisements
Advertisements

प्रश्न

Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple containing length of each word of a string.
For example, if the string is "Come let us have some fun", the tuple will have (4, 3, 2, 4, 4, 3)

टीपा लिहा
Advertisements

उत्तर

def lenWords (STRING) :
       T=()
        L=STRING.split ()
        for word in L:
               length=len (word)
               T=T+(length,)
return T
shaalaa.com
Reading from a Text File in Python
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×