본문 바로가기
Python 배우기

lists.py

by 노화방지 Anti-aging Hairstyle 2016. 3. 6.
반응형
squares = [1, 4, 9, 16, 25]   # create new list
print(squares)

print(squares[1:4])

산출물 (Output)
[1, 4, 9, 16, 25]
[4, 9, 16]



* A list is a data structure you can use to store a collection of different pieces of information under a single variable name.
A list can be written as an array of comma-separated values (items) between square brackets, e.g. lst = [item1, item2].
Lists might contain items of different types, but usually all the items in the list are of the same type.
Like strings, lists can be indexed and sliced (see Lesson 3).


반응형

'Python 배우기' 카테고리의 다른 글

list_items.py  (0) 2016.03.07
list_operations.py  (0) 2016.03.07
string_methods.py  (0) 2016.03.06
character_escaping.py  (0) 2016.03.06
len_function.py  (0) 2016.03.06

댓글