python / beginner
Snippet
List Operations
Lists are ordered collections of items. You can add items using the .append() method and access them using their zero-based index.
snippet.py
1
2
3
4
tools = ["IDE", "Terminal"]tools.append("Debugger")first_tool = tools[0]print(f"Using: {first_tool}")
Breakdown
1
tools = [...]
Creates a new list with two initial string elements.
2
tools.append("Debugger")
Adds a new element to the end of the list.
3
first_tool = tools[0]
Retrieves the first element ('IDE') from the list using index 0.