Python Open source Many applications Python 3 jupyter notebook Indentation : no begin end
Variable Case sensitive
Type conversion
Python data types float : real numbers int : integer numbers str : string, text bool : True.False Python List : [a, b, c] Collection of variables Contain any type Contain different types
Subset of lists Zero based indexing : [1, “ab”, 3.4] 1은 0번째 “ab"는 1번째
List slicing : 를 이용함2 list[index1: index2 ] list[:index] list[index:] : 를 이용함2 list[index1: index2 ] index1 부터 index2-1 까지 test[2:4] : text list의 2번째 부터 (4-1) 번째 list[:index] list[index:] -3 -2 -1 1 2 3 4 5
List indexing List of lists
Mutable List Mutable : 내용을 변화할 수 있음 Change list elements Add list elements Remove list elements
Adding and removing
Replace list elements
Copying lists Use = sign to copy lists
Copying lists x y Use list to copy
Looping through a list indentation for item-variable in list : # code
While loop while condition : # code
Sorting a list and append an element sorted() sort()
ranges range(index) : 0 – (index-1)
Dictionary Key와 value로 표현되는 데이터 구조 Mutable Create an empty dictionary Create a dictionary
Delete a dictionary elements List와 마찬가지로 del del(list[index]) del(dictionary[key])
Unique keys
Returning a value and get() function
Print dictionary elements
Print dictionary items dictionary.items() 은 key value pair return
Dictionary contains a dictionary
Print dictionary items
Remove items