- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Day 13 List Comprehension #coding #programming #python #dataengineering
List Comprehension என்றால் என்ன?
List Comprehension என்பது Python-ல் ஒரு புதிய List-ஐ மிகவும் குறைந்த Code-ல், வேகமாக உருவாக்க உதவும் ஒரு சிறந்த முறையாகும்.
எளிமையாக சொன்னால்:
Loop + List Creation ஆகிய இரண்டையும் ஒரே வரியில் எழுதும் முறையே List Comprehension ஆகும்.
Normal Method
1 முதல் 5 வரை உள்ள எண்களின் Square-ஐ List-ல் சேமிக்க:
numbers = []
for i in range(1, 6):
numbers.append(i * i)
print(numbers)
Output:
[1, 4, 9, 16, 25]
List Comprehension Method
அதே Program:
numbers = [i * i for i in range(1, 6)]
print(numbers)
Output:
[1, 4, 9, 16, 25]
Why We Use List Comprehension?
1. Less Code
Normal Method:
for
append
List Comprehension:
One Line
2. Better Readability
employees = [salary * 1.10 for salary in salaries]
என்று பார்த்தவுடன் என்ன நடக்கிறது என்று புரியும்.
3. Faster Processing
Python Internally Optimize செய்வதால்:
List Comprehension
↓
Faster than Loop
Real Banking Example
Suppose:
loan_amounts = [
10000,
20000,
30000,
40000
]
10% Processing Fee Calculate செய்ய:
fees = [
amount * 0.10
for amount in loan_amounts
]
print(fees)
Output:
[1000, 2000, 3000, 4000]
Filter Example
50000-க்கு மேல் Salary உள்ள Employees மட்டும்:
salaries = [
30000,
50000,
60000,
70000
]
result = [
salary
for salary in salaries
if salary greater than 50000
]
print(result)
Output:
[60000, 70000]
Real Data Engineering Example
Imagine:
customer.csv
↓
Read Data
↓
Transform Data
↓
Load Data
Customer IDs-ஐ Extract செய்ய:
customer_ids = [
row["customer_id"]
for row in data
]
Syntax
[
expression
for item in iterable
]
With Condition
[
expression
for item in iterable
if condition
]
Interview Answer
What is List Comprehension?
List Comprehension is a concise way to create lists in Python using a single line of code. It improves code readability and performance by combining loops and list creation into one expression.
Simple Tamil Definition
Loop பயன்படுத்தி ஒரு புதிய List-ஐ குறைந்த Code-ல், ஒரே வரியில் உருவாக்கும் முறையே List Comprehension ஆகும்.
Easy Memory Trick
Traditional Method
↓
for + append()
List Comprehension
↓
One Line
↓
Create List Quickly
Data Engineer Perspective
Read Data
↓
Transform Data
↓
Create New List
இதுபோன்ற Data Transformation வேலைகளில் List Comprehension அதிகமாக பயன்படுத்தப்படுகிறது.
Example
customer_names = [
customer["name"]
for customer in customers
]
இதனால் Code சுத்தமாகவும், வேகமாகவும், Production-ready ஆகவும் இருக்கும். 🚀
Видео Day 13 List Comprehension #coding #programming #python #dataengineering канала DATA FORGE TAMIL
List Comprehension என்பது Python-ல் ஒரு புதிய List-ஐ மிகவும் குறைந்த Code-ல், வேகமாக உருவாக்க உதவும் ஒரு சிறந்த முறையாகும்.
எளிமையாக சொன்னால்:
Loop + List Creation ஆகிய இரண்டையும் ஒரே வரியில் எழுதும் முறையே List Comprehension ஆகும்.
Normal Method
1 முதல் 5 வரை உள்ள எண்களின் Square-ஐ List-ல் சேமிக்க:
numbers = []
for i in range(1, 6):
numbers.append(i * i)
print(numbers)
Output:
[1, 4, 9, 16, 25]
List Comprehension Method
அதே Program:
numbers = [i * i for i in range(1, 6)]
print(numbers)
Output:
[1, 4, 9, 16, 25]
Why We Use List Comprehension?
1. Less Code
Normal Method:
for
append
List Comprehension:
One Line
2. Better Readability
employees = [salary * 1.10 for salary in salaries]
என்று பார்த்தவுடன் என்ன நடக்கிறது என்று புரியும்.
3. Faster Processing
Python Internally Optimize செய்வதால்:
List Comprehension
↓
Faster than Loop
Real Banking Example
Suppose:
loan_amounts = [
10000,
20000,
30000,
40000
]
10% Processing Fee Calculate செய்ய:
fees = [
amount * 0.10
for amount in loan_amounts
]
print(fees)
Output:
[1000, 2000, 3000, 4000]
Filter Example
50000-க்கு மேல் Salary உள்ள Employees மட்டும்:
salaries = [
30000,
50000,
60000,
70000
]
result = [
salary
for salary in salaries
if salary greater than 50000
]
print(result)
Output:
[60000, 70000]
Real Data Engineering Example
Imagine:
customer.csv
↓
Read Data
↓
Transform Data
↓
Load Data
Customer IDs-ஐ Extract செய்ய:
customer_ids = [
row["customer_id"]
for row in data
]
Syntax
[
expression
for item in iterable
]
With Condition
[
expression
for item in iterable
if condition
]
Interview Answer
What is List Comprehension?
List Comprehension is a concise way to create lists in Python using a single line of code. It improves code readability and performance by combining loops and list creation into one expression.
Simple Tamil Definition
Loop பயன்படுத்தி ஒரு புதிய List-ஐ குறைந்த Code-ல், ஒரே வரியில் உருவாக்கும் முறையே List Comprehension ஆகும்.
Easy Memory Trick
Traditional Method
↓
for + append()
List Comprehension
↓
One Line
↓
Create List Quickly
Data Engineer Perspective
Read Data
↓
Transform Data
↓
Create New List
இதுபோன்ற Data Transformation வேலைகளில் List Comprehension அதிகமாக பயன்படுத்தப்படுகிறது.
Example
customer_names = [
customer["name"]
for customer in customers
]
இதனால் Code சுத்தமாகவும், வேகமாகவும், Production-ready ஆகவும் இருக்கும். 🚀
Видео Day 13 List Comprehension #coding #programming #python #dataengineering канала DATA FORGE TAMIL
Комментарии отсутствуют
Информация о видео
Вчера, 11:35:11
00:00:17
Другие видео канала

















