@@ -71,7 +71,7 @@ def append_item_to_list(the_list, item):
71
71
print ("Function: remove_item_from_list" )
72
72
73
73
def remove_item_from_list (the_list , item ):
74
- # ...
74
+ the_list . remove ( item )
75
75
return the_list
76
76
77
77
# If you have trouble here, make sure you're returning the
@@ -87,7 +87,7 @@ def remove_item_from_list(the_list, item):
87
87
print ("Function: count_items_in_list" )
88
88
89
89
def count_items_in_list (the_list , item ):
90
- return # ...
90
+ return the_list . count ( item )
91
91
92
92
# Whereas here you'll need to return the result of the
93
93
# function you call, not the list.
@@ -102,7 +102,7 @@ def count_items_in_list(the_list, item):
102
102
print ("Function: get_index_of_item" )
103
103
104
104
def get_index_of_item (the_list , item ):
105
- return # ...
105
+ return the_list . index ( item )
106
106
107
107
check_that_these_are_equal (
108
108
get_index_of_item (['a' , 'b' , 'c' ], 'b' ), 1 )
@@ -115,7 +115,7 @@ def get_index_of_item(the_list, item):
115
115
print ("Function: reverse_list" )
116
116
117
117
def reverse_list (the_list ):
118
- # ...
118
+ the_list . reverse ()
119
119
return the_list
120
120
121
121
check_that_these_are_equal (
@@ -130,7 +130,7 @@ def reverse_list(the_list):
130
130
131
131
# Note — it's the same as for strings!
132
132
def list_length (the_list ):
133
- return # ...
133
+ return len ( the_list )
134
134
135
135
check_that_these_are_equal (
136
136
list_length (['a' , 'b' , 'c' ]), 3 )
0 commit comments