List
-
[Python tutorial] 21. List/Array methods코딩/Python 2022. 12. 21. 17:18
list.append(elmnt) Adds an element at the end of the list fruits = ['apple', 'banana', 'cherry'] fruits.append("orange") list.clear() Removes all the elements from the list fruits = ['apple', 'banana', 'cherry', 'orange'] fruits.clear() list.copy() Returns a copy of the list fruits = ['apple', 'banana', 'cherry', 'orange'] x = fruits.copy() list.count(value) Returns the number of elements with t..
-
[Python tutorial] 7. Data type - List코딩/Python 2022. 12. 21. 17:12
List ordered changeable allow duplicate values Note Python에는 array가 없고 list를 대신 사용할 수 있다. 대량의 데이터는 NumPy를 사용한다. thislist = ["apple", "banana", "cherry", "apple", "cherry"] # allow duplicate values print(thislist) ['apple', 'banana', 'cherry', 'apple', 'cherry'] List Length: len() print(len(thislist)) # 5 Data Types - any data types list1 = ["apple", "banana", "cherry"] list2 = [1, 5, 7, 9, 3] li..