Spaces:
Runtime error
Runtime error
Download docs/python_lists.txt from amoyakd/RAG-Based-Product-Inquiry-ChatBot: direct link, hf CLI and curl.
- Browser
- Download file 488 Bytes
-
https://huggingface.co/spaces/amoyakd/RAG-Based-Product-Inquiry-ChatBot/resolve/main/docs/python_lists.txt
- Command line
-
hf download hf://spaces/amoyakd/RAG-Based-Product-Inquiry-ChatBot/docs/python_lists.txt
-
curl -L -o python_lists.txt https://huggingface.co/spaces/amoyakd/RAG-Based-Product-Inquiry-ChatBot/resolve/main/docs/python_lists.txt
488 Bytes
| Python Lists | |
| Lists in Python are ordered, mutable sequences. You can create a list using square brackets: | |
| my_list = [1, 2, 3, 4, 5] | |
| Adding Items: | |
| - Use append() to add one item: my_list.append(6) | |
| - Use extend() to add multiple items: my_list.extend([7, 8, 9]) | |
| - Use insert() to add at specific position: my_list.insert(0, 0) | |
| Accessing Items: | |
| - Use indexing: my_list[0] gets first item | |
| - Use slicing: my_list[1:3] gets items 1 and 2 | |
| - Negative indexing works: my_list[-1] gets last item |