# data[].attributes.body
Học sinh sẽ nắm được định nghĩa của kiểu dữ liệu danh sách và các đặc tính cơ bản.

# data[].attributes.body
Học sinh sẽ học cách sử dụng một số lệnh làm việc cơ bản như thêm, xóa, và sửa phần tử trong danh sách.

# data[].attributes.body
Học sinh sẽ áp dụng kiến thức vào việc giải quyết bài toán thực tế sử dụng danh sách.

# data[].attributes.body
Bạn đã từng sử dụng danh sách (list) trong các ứng dụng hằng ngày chưa? Hãy nêu ví dụ cụ thể.

# data[].attributes.body
Giáo viên giải thích ngắn gọn về danh sách và lệnh thao tác cơ bản qua bài giảng trực quan.

# data[].attributes.attachment_link.title
Data Types in Python | Python for Beginners

# data[].attributes.headline
Thảo luận nhóm - Khám phá lệnh thêm phần tử

# data[].attributes.subject
Thảo luận nhóm - Khám phá lệnh thêm phần tử

# data[].attributes.body
Làm việc nhóm để thử nghiệm và thảo luận về cách thêm phần tử vào danh sách trong Python.

# data[].attributes.attachment_link.description
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

# data[].attributes.body
Tự thực hiện lệnh thêm, xóa, và sửa trong danh sách.

# data[].attributes.attachment_link.description
Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.

# data[].attributes.body
Khám phá thêm các lệnh nâng cao như sắp xếp danh sách hoặc lọc danh sách.

# data[].attributes.attachment_link.title
Advanced Python List Methods and Techniques - GeeksforGeeks

# data[].attributes.attachment_link.description
Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.

# data[].attributes.body
Một bài kiểm tra ngắn nhằm kiểm tra khả năng sử dụng các lệnh cơ bản với kiểu dữ liệu danh sách.

# data[].attributes.attachment_link.description
Python List Quiz Quiz will help you to test and validate your Python-Quizzes knowledge. It covers a variety of questions, from basic to advanced. The quiz contains 25 questions. You just have to assess all the given options and click on the correct answer.

# data[].attributes.body
Giáo viên quan sát học sinh thực hành và đưa ra góp ý.

# data[].attributes.body
Các nhóm trình bày những bài học rút ra từ buổi học thông qua ví dụ cụ thể.

# data[].attributes.body
Học sinh trả lời nhanh câu hỏi: 'Điều gì khiến bạn cảm thấy hứng thú nhất trong buổi học hôm nay?'

# data[].attributes.body
Viết một đoạn mã Python sử dụng ít nhất 3 lệnh thao tác danh sách khác nhau.

# data[].attributes.attachment_link.readable_text
Python List [280 exercises with solution]

A list is a container which holds comma-separated values (items or elements) between square brackets where items or elements need not all have the same type.
You may read our Python list tutorial before solving the following exercises.
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]

17. Write a Python program to check if each number is prime in a given list of numbers. Return True if all numbers are prime otherwise False.
Sample Data:
([0, 3, 4, 7, 9]) -> False
([3, 5, 7, 13]) -> True
([1, 5, 3]) -> False
Click me to see the sample solution

34. Write a Python program that uses the Sieve of Eratosthenes method to compute prime numbers up to a specified number.
Note: In mathematics, the sieve of Eratosthenes, (Ancient Greek: κόσκινον Ἐρατοσθένους, kóskinon Eratosthénous) one of a number of prime number sieves, is a simple, ancient algorithm for finding all prime numbers up to any given limit.
Click me to see the sample solution

82. Write a Python program to generate combinations of n distinct objects taken from the elements of a given list.
Original list: [1, 2, 3, 4, 5, 6, 7, 8, 9] Combinations of 2 distinct objects: [1, 2] [1, 3] [1, 4] [1, 5] .... [7, 8] [7, 9] [8, 9]
Click me to see the sample solution

85. Write a Python program to create a multidimensional list (lists of lists) with zeros.
Multidimensional list: [[0, 0], [0, 0], [0, 0]]
Click me to see the sample solution

254. Write a Python program to get the weighted average of two or more numbers.
Sample Output:
Original list elements:
[10, 50, 40]
[2, 5, 3]
Weighted average of the said two list of numbers:
39.0
Original list elements:
[82, 90, 76, 83]
[0.2, 0.35, 0.45, 32]
Weighted average of the said two list of numbers:
82.97272727272727
Click me to see the sample solution

274. Write a Python program to count the lowercase letters in a given list of words.
Sample Data:
(["Red", "Green", "Blue", "White"]) -> 13
(["SQL", "C++", "C"]) -> 0
Click me to see the sample solution

275. Write a Python program to add all elements of a list of integers except the number at index. Return the updated string.
Sample Data:
([0, 9, 2, 4, 5, 6] -> [26, 17, 24, 22, 21, 20]
([-4, 0, 6, 1, 0, 2]) -> [9, 5, -1, 4, 5, 3]
([1, 2, 3]) -> [5, 4, 3]
([-4, 0, 5, 1, 0, 1]) -> [7, 3, -2, 2, 3, 2]
Click me to see the sample solution

276. Write a Python program to find the largest odd number in a given list of integers.
Sample Data:
([0, 9, 2, 4, 5, 6]) -> 9
([-4, 0, 6, 1, 0, 2]) -> 1
([1, 2, 3]) -> 3
([-4, 0, 5, 1, 0, 1]) -> 5
Click me to see the sample solution

277. Write a Python program to calculate the largest and smallest gap between sorted elements of a list of integers.
Sample Data:
{1, 2 ,9, 0, 4, 6} -> 3
{23, -2, 45, 38, 12, 4, 6} -> 15
Click me to see the sample solution

278. Write a Python program to sum the missing numbers in a given list of integers.
Sample Data:
([0, 3, 4, 7, 9]) -> 22
([44, 45, 48]) -> 93
([-7, -5, -4, 0]) -> -12
Click me to see the sample solution

279. Write a Python program to extract the first specified number of vowels from a given string. If the specified number is less than the number of vowels present in the string then display "n is less than the number of vowels present in the string".
Sample Data:
("Python", 2) -> "n is less than number of vowels present in the string."
("Python Exercises", 3) -> "oEe"
("aeiou") -> "AEI"
Click me to see the sample solution

280. Write a Python program that takes a list of integers and finds all pairs of integers that differ by three. Return all pairs of integers in a list.
Sample Data:
([0, 3, 4, 7, 9]) -> [[0, 3], [4, 7]]
[0, -3, -5, -7, -8] -> [[-3, 0], [-8, -5]]
([1, 2, 3, 4, 5]) -> [[1, 4], [2, 5]]
([100, 102, 103, 114, 115]) -> [[100, 103]]
Click me to see the sample solution

List: Cheat Sheet
Making a list:

colors = ['Red', 'Blue', 'Green', 'Black', 'White']

Accessing elements:

# Getting the first element
first_col = colors[0]
# Getting the second element
second_col = colors[1]
# Getting the last element
newest_col = colors[-1]

Modifying individual items:

# Changing an element
colors[0] = 'Yellow'
colors[-2] = 'Red'

Adding elements:

# Adding an element to the end of the list
colors.append('Orange')
# Starting with an empty list
colors = []
colors.append('Red')
colors.append('Blue')
colors.append('Green')
# Inserting elements at a particular position
colors.insert(0, 'Violet')
colors.insert(2, 'Purple')

Removing elements:

# Deleting an element by its position
del colors[-1]
# Removing an item by its value
colors.remove('Green')

Popping elements:

# Pop the last item from a list
most_recent_col = colors.pop()
print(most_recent_col)
# Pop the first item in a list
first_col = colors.pop(0)
print(first_col)

List length:

# Find the length of a list
num_colors = len(colors)
print("We have " + str(num_colors) + " colors.")

Sorting a list:

# Sorting a list permanently
colors.sort()
# Sorting a list permanently in reverse alphabetical order
colors.sort(reverse=True)
# Sorting a list temporarily
print(sorted(colors))
print(sorted(colors, reverse=True))
# Reversing the order of a list
colors.reverse()

Looping through a list:

# Printing all items in a list
for col in colors:
 print(col)
# Printing a message for each item, and a separate message afterwards
for col in colors:
 print("Welcome, " + col + "!")
print("Welcome, we're glad to see you all!")

The range() function:

# Printing the numbers 0 to 2000
for num in range(2001):
 print(num)
# Printing the numbers 1 to 2000
for num in range(1, 2001):
 print(num)
# Making a list of numbers from 1 to a million
nums = list(range(1, 1000001))

Simple statistics:

# Finding the minimum value in a list
nums = [23, 22, 44, 17, 77, 55, 1, 65, 82, 2]
num_min = min(nums)
# Finding the maximum value
nums = [23, 22, 44, 17, 77, 55, 1, 65, 82, 2]
num_max = max(nums)
# Finding the sum of all numbers
nums = [23, 22, 44, 17, 77, 55, 1, 65, 82, 2]
total_num = sum(nums)

Slicing a list:

# Getting the first three items
colors = ['Red', 'Blue', 'Green', 'Black', 'White']
first_three = colors [:3]
# Getting the middle three items
middle_three = colors[1:4]
# Getting the last three items
last_three = colors[-3:]

Copying a list:

# Making a copy of a list
colors = ['Red', 'Blue', 'Green', 'Black', 'White']
copy_of_colors = colors[:]

List of Comprehensions:

# Using a loop to generate a list of square numbers
squr = []
for x in range(1, 11):
 sq = x**2
 squr.append(sq)
# Using a comprehension to generate a list of square numbers
squr = [x**2 for x in range(1, 11)]
# Using a loop to convert a list of names to upper case
colors = ['Red', 'Blue', 'Green', 'Black', 'White']
upper_cols = []
for cols in colors:
 upper_cols.append(cols.upper())
# Using a comprehension to convert a list of names to upper case
colors = ['Red', 'Blue', 'Green', 'Black', 'White']
upper_cols = [cols.upper() for cols in colors]

Python Code Editor:
More to Come !Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
Test your Python skills with w3resource's quiz

# data[].attributes.attachment_link.title
Python List - Exercises, Practice, Solution - w3resource

# data[].attributes.attachment_link.description
Python List Exercises, Practice and Solution - Contains 280 Python list exercises with solutions for beginners to advanced programmers. These exercises cover various topics such as summing and multiplying items, finding large and small numbers, removing duplicates, checking emptiness, cloning or copying lists, generating 3D arrays, generating permutations, and many more.

# data[].attributes.body
Khám phá và viết ví dụ với ít nhất 2 lệnh danh sách nâng cao.

# data[].attributes.attachment_link.title
25 Advanced English Grammar Test Practice Questions With Answers & Explanations

# data[].attributes.body
Học sinh có thể vào đây để xem bài, ôn lại kiến thức.

# data[].attributes.attachment_link.description
Not your computer? Use Guest mode to sign in privately. Learn more about using Guest mode