4.1.1 Lists
Computational Structures
A list is a data structure used to store multiple pieces of data in a specific sequence. Each piece of data, known as an element, is positioned at a particular index within the list, facilitating easy access and management.
4.1.1.1 List Creation
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:
# 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”.