LISTS AS ARRAYS IN PYTHON Python-ல் traditional programming languages போல separate built-in array syntax இல்ல……
List as Arrays
Python List என்பது multiple values-ஐ ஒரே variable-ல் ordered collection ஆக store செய்யும் mutable data structure. Simple definition: A Python list can be used like an array to store multiple values in a single variable.
Python List என்பது multiple values-ஐ ஒரே variable-ல் ordered collection ஆக store செய்ய……
marks = [80, 75, 90, 88] இங்கே: marks……
Suppose 5 students marks இருக்கிறது: 80 75 90 88 95 Separate variables பயன்படுத்தலாம்: mark1 = 80 mark2 = 75 ……
Basic List syntax: list_name = ……
numbers = [10, 20, 30, 40] இதன் index: Value 10 20 30 40……
Traditional Array-ல்: Multiple values Stored in sequence Acce……
அதனால் List-ஐ array மாதிரி பய……
numbers = [10, 20, 30, 40, 50]…
numbers = [10, 20, 30, 40, 50] numbers என்பது list variable. Squ……
List element access செய்ய inde……
numbers = [10, 20, 30, 40] print(numbe……
Python List-ல் negative index……
-1 = last element -2 = second……
List-ன் மிக முக்கியமான property: List is Mutable. அதாவது lis……
Initially: [10, 20, 30] Index 1: 20 Statement: numbers[1……
Traditional typed arrays-ல் பொதுவாக same data type values இரு……
இதில்: 10 -> int Python -> st……
இதுதான் Python List மற்றும் traditional Array இடையே முக்கிய di……
ஒரு List-ல் எத்தனை elements இருக்கி……
List-க்கு புதிய element add செய்ய பல methods உள்ளன. Main methods: append() insert() e……
Before: [10, 20, 30] Operation: numbers.append(40) ……
list.insert(index, value) num……
numbers.insert(1, 20) means: Index = 1 Value = 20 Index 1 position-ல் 20 insert செய்யப்படுகிறது. Exi……
a = [10, 20] a.append([30, 40……
But: a = [10, 20] a.extend([3……
Important methods: remove() pop() clear() And statement: de……
remove() value அடிப்படையில் remove செய்கிறது. numbers.remove(20) என்பது in……
numbers = [10, 20, 30]…
numbers = [10, 20, 30] number……
Default: Last element removed. [3……
numbers = [10, 20, 30] del nu……
List-ன் all elements remove ச……
numbers = [10, 20, 30] number……
List itself exists. Elements ……
List-லும் String மாதிரி slicing poss……
Start = Included Stop = Excluded Fo……
numbers = [10, 20, 30, 40, 50……
List elements one by one access செய்ய ……
numbers = [10, 20, 30] First iterat……
numbers = [10, 20, 30] for i ……
returns: 3 So:…
produces: 0, 1, 2 These are v……
Python built-in sum() பயன்படு……
numbers = [10, 50, 20, 40] pr……
numbers = [10, 50, 20, 40] pr……
sort() Original List-ஐ sort செ……
numbers = [40, 10, 30, 20] nu……
numbers = [40, 10, 30, 20] new_numb……
Important difference: sort() Modi……
reverse() List elements order-ஐ rev……
ஒரு value எத்தனை times இருக்கிறது ……
ஒரு value first time எங்கு உள்ளது ……
List-ல் value இருக்கிறதா என்ற……
Two Lists combine செய்ய + பயன……
- operator பயன்படுத்தி List r……
a = [1, 2]…
ஒரு List-க்குள் இன்னொரு List ……
இதற்கு: Nested List என்று சொல……
Nested List-ஐ matrix அல்லது 2……
Structure: Row 0 -> [1, 2, 3]……
First: matrix[0] gives: [1, 2, 3]……
matrix = [ [10, 20], [30, 40]……
matrix = [ [1, 2], [3, 4] ] f……
Outer loop: for row in matrix: First: row = [1,……
Python-ல் Lists create செய்ய compact ……
squares = [x * x for x in ran……
squares = [] for x in range(1……
Both same result.…
இந்த concept மிகவும் importan……
இதில் new independent List create……
a = [10, 20, 30] b = a a[0] =……
Reason: a and b both refer to……
Independent copy create செய்ய: a =……
b = a[:] இதுவும் shallow copy……
Python List மற்றும் conventio……
Beginner level-ல்: List can be used as an array. என்று சொல்லலாம். ஆனால் technically: Python list is not a ……
Python Standard Library-ல் true ……
இங்கே: 'i' integer type code. இந்த ar……
List: values = [10, "Python", 3.14] Mixed types possible. Ar……
Scientific computing-க்கு: Nu……
NumPy arrays large numeric ca……
List: a = [1, 2, 3] print(a *……
List repeats. NumPy:…
NumPy performs mathematical mult……
marks = [80, 75, 90, 85, 95]…
marks = [80, 75, 90, 85, 95] ……
Suppose temperatures: temperature = [31, 32, 30, 33, 34] Access today's first recorded temperature: print(t……
numbers = [10, 20, 30] print(……
IndexError Why? Valid indexes……
Confusing index and value: numbers = [10, 20, 30] numbers.remove(1) இத……
numbers = [10, 20] numbers.ap……
append() ஒரே argument மட்டுமே எடுக்கு……
numbers = [10, 20, 30] x = nu……
Why? sort() list-ஐ in-place modify செய்கி……
a = [1, 2, 3] b = a இதனை independent copy என்று……
List characteristics: Ordered Mutable Index……
a = [10, 20, 30] Order mainta……
a = [10, 20, 10, 30] print(a)…
Duplicate 10 allowed.…
List size fixed அல்ல. Initially: a = [10, 20] Then:……
C language: int a[3] = {10, 20, 30}; Size: 3 normally fi……
Remember LIST: L = Large number of values I = Indexed S = Seque……
TRB, NET, SET exam-க்கு important: Python List uses square brackets. a = [1, 2, 3] List index starts at 0. Ne……
Can Python Lists be used as arrays? Answer: Yes. Python Lists are commonly used as dynamic array-like contain……
What is the main difference between a Python List and a traditional Array? Answer: A Python List ……
Why is a Python List mutable? Answer: Because its elements can be a……
Difference between append() and extend()? Answ……
a = [1, 2] a.append([3, 4])…
While: a = [1, 2] a.extend([3……
Which brackets are used to cr……
What is the first index of a ……
Which statement is true about……
What is the output? a = [10, ……
What is the output? a = [10, ……
Which method adds an element ……
Which method removes a value ……
What is the result? a = [1, 2……
What is the result? a = [1, 2]……
What does len([10, 20, 30]) r……
Which method sorts the same L……
What is the output? a = [1, 2……
Given: numbers = [10, 20, 30, 40, 50] Find output: print(numbers[0]) print(numbe……
Python Lists as Arrays | +-------------------------------+ | +-- Creation | [10, 20, 30] | +-- Access | list[……
Python-ல் Lists arrays மாதிரி multiple values store செய்யப் பயன்படுத்தப்படுகின்றன. Creation: numbers = [10, 2……
A Python List is an ordered, mutable and dynamically sized collection that can be us……