← back to unit
Easy
# basics variables
Data Types: list
A list stores many values together, in order, inside square brackets [ ], separated by commas:
fruits = ["apple", "banana", "cherry"]
print(fruits)
print(type(fruits))
prints:
['apple', 'banana', 'cherry']
<class 'list'>
A list can hold numbers too, or even a mix of types.
Your turn: create a list called colors containing exactly "red", "green", "blue" (in that order). Print colors, then print type(colors).
💡 need a hint?
pyb-var-types-list.py
loading...