Advertisements
Advertisements
Question
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)
Short/Brief Note
Advertisements
Solution
def lenWords (STRING) :
T=()
L=STRING.split ()
for word in L:
length=len (word)
T=T+(length,)
return Tshaalaa.com
Reading from a Text File in Python
Is there an error in this question or solution?
