4.1.1.1 List Creation
Computational Structures
In Python, Lists are created using square brackets '[]', with each item separated by a comma. Here's how you can create and work with a list in Python:
python
# Create a list of items
items= [ "Decorations" , "Snacks" , "cold drinks", "Plates", "Balloon"]
# Print the list
print(items)In the above code:
“items” is the name of the list.
The items inside the list are “Decorations”, “Snacks”, “Cold drinks”, “Plates”, and “Balloons”.
Each item is enclosed in quotes (for text) and separated by a comma.
The print () function is used to display the list.