Back to Freecodecamp

Step 2

curriculum/challenges/english/blocks/learn-lambda-functions-by-building-an-expense-tracker/66694eaaeb7d253049fa7883.md

latest953 B
Original Source

--description--

To add items to a list, you can write them between the square brackets, separating the values with commas.

Add the numbers 1 and 2 inside the list.

--hints--

The first element of my_list should be 1.

js
({
    test: () => runPython(`
        assert my_list[0] == 1, "my_list[0] is not 1"
    `)
})

The second element of my_list should be 2.

js
({
    test: () => runPython(`
        assert my_list[1] == 2, "my_list[1] is not 2"
    `)
})

my_list should have two elements inside.

js
({
    test: () => runPython(`
        assert len(my_list) == 2, "my_list doesn't have two elements"
    `)
})

You should assign [1, 2] to my_list directly.

js
({
    test: () => runPython(`
        assert _Node(_code).find_variable('my_list').is_equivalent("my_list = [1, 2]")
    `)
})

--seed--

--seed-contents--

py
--fcc-editable-region--
my_list = []
--fcc-editable-region--