Solution 1

heterogeneous = [12, "I'm a string!", True]

Create List with Literals

You don't always have to put variables in your lists. You can also just directly
put data in there.


fancy_list = ["i am data that is not stored in a variable! OMG!"]

Want to know something cool? Lists are very progressive!
They are heterogeneous and support diversity! That means that you can put
multiple data types inside the same list. Integers, booleans, strings, floats, other lists, everything is good here! Safe space.

For this assignment, create a list named heterogeneous and put an integer, a string, and a boolean in it. In that order.

Test Cases

test list literals - Run Test

def test_list_literals():
    assert type(heterogeneous) == list, "Oops, heterogeneous is not a list"

    assert len(heterogeneous) == 3

    assert type(heterogeneous[0]) == int
    assert type(heterogeneous[1]) == str
    assert type(heterogeneous[2]) == bool
# Create a list named `heterogeneous` and put a integer, string, and boolean in it.