반응형
buy_list = ['Naver', '5000']
print(buy_list[0])
print(buy_list[1])
naver = [9130, 9150, 9150, 9300, 9400]
print("length: %d" % len(naver))
print(naver[0])
print(naver[1])
print(naver[2])
print(naver[3])
print(naver[4])
print()
print()
print()
print()
print(naver[-1])
print(naver[-2])
print(naver[-3])
print(naver[-4])
print(naver[-5])
실행 결과
$ py list_indexing.py
Naver
5000
length: 5
9130
9150
9150
9300
9400
9400
9300
9150
9150
9130
반응형
'Programming > Python' 카테고리의 다른 글
[Python-Basic] List Data Type - 5 (Slicing) (0) | 2019.11.05 |
---|---|
[Python-Basic] List Data Type - 4 (Remove) (0) | 2019.11.05 |
[Python-Basic] List Data Type - 2 (Generate) (0) | 2019.11.05 |
[Python-Basic] List Data Type - 1(Add) (0) | 2019.11.05 |
[Python-Basic] Dictionary Data Type - 3 (0) | 2019.11.05 |