1. Creating a List 6.
Looping Through a List
You can create a list using square brackets []: Using a for loop
Using a while loop
2. Accessing List Elements
7. List Slicing
Indexing
Extract a portion of the list:
Lists use zero-based indexing, meaning the first
element is at index 0.
3. Modifying a List 8. Sorting and Reversing a List
Lists are mutable, meaning elements can be Sorting a List
changed.
4. Adding Elements to a List
Using append() (adds at the end) Reverse a list
5. Removing Elements from a List
Using pop() (removes by index and returns the
value)
9. Copying a List Using while loop
1. Creating a Tuple
Tuples are created using parentheses (). 6. Tuple Length
To find the number of elements in a tuple:
7. Concatenating and Repeating Tuples
Concatenation (Joining Two Tuples)
2. Accessing Tuple Elements
Tuples use zero-based indexing like lists.
8. Checking if an Element Exists in a Tuple
4. Tuples are Immutable
Once a tuple is created, its elements cannot be
modified.
9. Tuple Methods
Even though tuples are immutable, they have
some useful methods.
5. Looping Through a Tuple Finding the Index of an Element
Using a for loop
Counting the Occurrences of an Element
10. Unpacking Tuples
Tuple unpacking allows you to assign multiple
values at once.