Summary of "Lecture 3 : List & Tuple in Python | Python Full Course"

Lecture 3 — Lists & Tuples in Python

Main ideas

Lists

Definition and basics

Common list methods (behavior notes)

Important: Many list-mutating methods (e.g., append, sort, reverse, insert, remove) change the list in-place and return None. Printing the result of such a method call will show None.

Tuples

Definition and basics

Key differences (lists vs tuples)

Step-by-step instructions / Examples

1. Creating and printing a list

marks = [94.4, 95.2, 66.4, 45.1]
print(marks)
print(type(marks))
print(len(marks))

2. Indexing and slicing

3. Mutating lists

marks[0] = new_value        # assign to index
marks.append(4)             # append
marks.insert(index, value)  # insert
marks.remove(value)         # remove first occurrence
removed = marks.pop(index)  # pop by index (returns removed element)
marks.reverse()             # reverse in-place
marks.sort()                # sort in-place (ascending)
marks.sort(reverse=True)    # sort in-place (descending)
copy = marks.copy()         # shallow copy
count = marks.count(value)  # count occurrences

4. Creating tuples

t = (1, 2, 3)   # or t = 1, 2, 3
single = (1,)   # single-element tuple needs trailing comma
empty = ()      # empty tuple
# Access:
first = t[0]
# You cannot modify: t[0] = x  # raises TypeError

5. Palindrome check (list)

copy = lst.copy()
copy.reverse()
if copy == lst:
    # palindrome
else:
    # not palindrome
if lst == lst[::-1]:
    # palindrome

6. Read three favorite movies from user into a list

movie1 = input()
movie2 = input()
movie3 = input()
movies = []
movies.append(movie1)
movies.append(movie2)
movies.append(movie3)
movies = []
movies.append(input("Enter movie 1: "))
movies.append(input("Enter movie 2: "))
movies.append(input("Enter movie 3: "))
movies = [input("Movie 1: "), input("Movie 2: "), input("Movie 3: ")]

7. Count grade ‘A’ occurrences in a tuple

grades = ('C', 'D', 'A', 'A', 'B', 'B', 'A')
count_A = grades.count('A')  # returns 3

8. Convert tuple to list and sort alphabetically

grades_list = list(grades)
grades_list.sort()  # sorts ascending (A → D)

Pitfalls and important notes

Practice problems (covered)

References / Tools mentioned

Note: The transcript used auto-generated subtitles; some names/websites may be transcribed incorrectly.

Speakers / sources

Category ?

Educational


Share this summary


Is the summary off?

If you think the summary is inaccurate, you can reprocess it with the latest model.

Video