diff --git a/031_list_modification.py b/031_list_modification.py index e0fb19f5..f28c20ba 100644 --- a/031_list_modification.py +++ b/031_list_modification.py @@ -71,7 +71,7 @@ def append_item_to_list(the_list, item): print("Function: remove_item_from_list") def remove_item_from_list(the_list, item): - # ... + the_list.remove(item) return the_list # If you have trouble here, make sure you're returning the @@ -87,7 +87,7 @@ def remove_item_from_list(the_list, item): print("Function: count_items_in_list") def count_items_in_list(the_list, item): - return # ... + return the_list.count(item) # Whereas here you'll need to return the result of the # function you call, not the list. @@ -102,7 +102,7 @@ def count_items_in_list(the_list, item): print("Function: get_index_of_item") def get_index_of_item(the_list, item): - return # ... + return the_list.index(list) check_that_these_are_equal( get_index_of_item(['a', 'b', 'c'], 'b'), 1) @@ -115,8 +115,7 @@ def get_index_of_item(the_list, item): print("Function: reverse_list") def reverse_list(the_list): - # ... - return the_list + return list(reversed(the_list)) check_that_these_are_equal( reverse_list(['a', 'b', 'c']), ['c', 'b', 'a']) @@ -130,7 +129,7 @@ def reverse_list(the_list): # Note — it's the same as for strings! def list_length(the_list): - return # ... + return len(the_list) check_that_these_are_equal( list_length(['a', 'b', 'c']), 3)