Working with Lists A list is a collection of items stored in a single variable. You can think of it as an array in JavaScript, but with more flexibility. Lists in Python can hold numbers, strings, or even a mix of different data types. Creating Lists JavaScript: Python: Lists are written inside square brackets . Unlike some languages, Python lists can store different types of values together: 👉 This makes lists powerful for handling data collections without worrying about type restrictions. Accessing Elements Indexing starts at , just like in JavaScript. Negative indexing allows access from the end: 👉 Negative indexes are handy when you want items from the end without calculating length. Updating Elements 👉 Lists are mutable , meaning you can change their contents after creation. Adding Items 👉 always adds to the end of the list. 👉 lets you place a new item at a specific position. 👉 merges another list into the existing one. Removing Items 👉 deletes the first matching value . 👉 removes an item at a specific position and returns it. 👉 without index removes the last element. 👉 empties the entire list at once. Iterating a List 👉 A simple loop gives you each item directly, without needing an index. 👉 gives you both the index and value in one go, very useful for displaying numbered lists. Slicing Lists 👉 Slicing lets you extract parts of a list without loops. It’s like JS but more powerful — you can even reverse a list with . 👉 General form: start → index to begin (default: 0) stop → index to end (exclusive, not included) step → how many items to skip (default: 1) This makes slicing very powerful, letting you grab ranges, skip items, or reverse a list in one line. Membership Check 👉 The keyword is the simplest way to check if an item exists in a list. Sorting and Reversing 👉 arranges items in ascending order. 👉 The option sorts in descending order. 👉 Works with strings too (alphabetical order). 👉 flips the list order without sorting. Copying Lists 👉 Assigning a list only creates a reference. Both variables point to the same list. 👉 Use or slicing ( ) to make a true copy. Quick Takeaway Lists are flexible containers that can hold mixed data types. Use indexing, slicing, and loops to access elements. , , and add items. , , and delete items. and help organize lists. Use to avoid accidental shared references. Python lists are more powerful and convenient than plain arrays in many languages.