curriculum/challenges/english/blocks/learn-lambda-functions-by-building-an-expense-tracker/66694fc4bba24f33ca01fa5b.md
Python has a handful of list methods. Such as methods for adding or removing list items.
You can add an item to the end of a list using the append() method. For example:
example_list = [4, 5, 6]
example_list.append(7)
example_list now is [4, 5, 6, 7].
Try to use the append() method to add 3 to my_list. Then print the list.
The last element of my_list should be 3.
({
test: () => runPython(`
assert my_list[2] == 3, "my_list[2] is not 3"
`)
})
my_list should have a length of 3.
({
test: () => runPython(`
assert len(my_list) == 3, "my_list doesn't have three elements"
`)
})
You should not change the list declaration.
({
test: () => runPython(`
assert _Node(_code).find_variable('my_list').is_equivalent("my_list = [1, 2]")
`)
})
You should print the list.
({
test: () => runPython(`
calls = _Node(_code).find_calls("print")
assert any(call.is_equivalent('print(my_list)') for call in calls)
`)
})
You should print the list after using append().
({
test: () => runPython(`
assert _Node(_code).is_ordered('my_list.append(3)', 'print(my_list)')
`)
})
--fcc-editable-region--
my_list = [1, 2]
--fcc-editable-region--