curriculum/challenges/english/blocks/learn-lambda-functions-by-building-an-expense-tracker/6669539c1379793f9cb8917c.md
Python lists are mutable which means that the value of the list items can be changed. You can change the value of an element using the bracket notation.
example_list = [4, 5, 6, 7]
example_list[1] = 'oh'
This will make example_list have value of [4, 'oh', 6, 7].
Change the first element of my_list to 0, then print the list to check the value.
Do not change the list declaration.
({
test: () => runPython(`
assert _Node(_code).find_variable('my_list').is_equivalent("my_list = [1, 2]")
`)
})
The first element of my_list should be 0.
({
test: () => runPython(`
assert my_list[0] == 0
`)
})
You should change the first element using my_list[0] = 0.
({
test: () => runPython(`
assert _Node(_code).has_stmt("my_list[0] = 0")
`)
})
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 changing the first element.
({
test: () => runPython(`
assert _Node(_code).is_ordered("my_list[0] = 0", "print(my_list)")
`)
})
--fcc-editable-region--
my_list = [1, 2]
my_list.append(3)
print(my_list)
print(my_list[0])
--fcc-editable-region--