You are given a list of strings. You need to create a new list that contains the length of each string in the original list. Which Python construct would be best suited for this?

  • Filter and lambda functions
  • For loop
  • List comprehensions
  • Map and lambda functions
List comprehensions are well-suited for this task as they allow you to generate a new list by applying an expression to each item in the original list.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *