Question: Python coding list matrix help: def return_lengths(my_list_of_string): return a new list: Finish this function which takes a list of strings and returns a list

Python coding list matrix help:

def return_lengths(my_list_of_string): """  return a new list:  Finish this function which takes a list of strings and returns a list of integers as the  length for each string.   For example, for ['how', 'are', 'you'] as the parameter,  the return value of this function should be [3, 3, 3]   Hint: you can use the code below to create a new, emtpy string:  my_new_string = [] """  
# test my_string_list1 = ['python', 'hello', '131'] print(return_lengths(my_string_list1)) print("--"*10) 
  def remove_ALL_cat(my_list): """  remove all the word "cat" from a list -- another solution:  Finish this function which takes a list and remove all the "cat" in this list.  For example, if the parameter my_list is ["cat", "dog", "tiger", "panther", "cat"], after running this function,  the list will become: ["dog", "tiger", "panther"]  This function does not have any explicit return value.   Hint: use count() to control your loop.  """ 
# test cats_and_birds = ['cat','cat','bird','cat','bird'] remove_ALL_cat(cats_and_birds) print(cats_and_birds) # ['bird', 'bird']  dogs = ['corgi','lab','grayhound'] remove_ALL_cat(dogs) print(dogs) # ['corgi', 'lab', 'grayhound'] 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!