Oct-01-2020, 01:27 AM
I have the following code:
['the', 3]
['quick', 5]
['brown', 5]
['fox', 3]
['jumps', 5]
['over', 4]
etc.
I wish to change it to produce the lengths only, namely the numbers.
Also, is this an example of lists inside lists (nested lists)?
I am trying to
s = "The quick brown fox jumps over the lazy dog." words = s.split() lengths = [[w.lower(), len(w)] for w in words] for length in lengths: print(length)The output is:
['the', 3]
['quick', 5]
['brown', 5]
['fox', 3]
['jumps', 5]
['over', 4]
etc.
I wish to change it to produce the lengths only, namely the numbers.
Also, is this an example of lists inside lists (nested lists)?
I am trying to