Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- iP
- firebaseui
- 타입스크립트
- 자바스크립트
- css
- 백준
- youtube iframe
- leetcode977
- 프로토타입
- nvmrc
- leetcode189
- mac
- Next.js
- Rest
- 커스텀알림
- 파이어베이스로그인
- 다리놓기
- react-firebaseui
- 구조분해할당
- nvm
- 기초
- Spread
- Python
- React
- 리액트
- JS
- 파이썬
- 커스텀알락
- yarn-berry
- react-native
Archives
- Today
- Total
JadeCode
[Python] 개념정리 - for문 index, value 접근 본문
1. range 이용
array = [1, 2, 5, 6, 7, 10]
for index in range(len(array)):
print(index,array[index])
# 결과:
# 0 1
# 1 2
# 2 5
# 3 6
# 4 7
# 5 10
2. enumerate() 이용
array = [1, 2, 5, 6, 7, 10]
for index, value in enumerate(array):
print(index, value)
# 결과:
# 0 1
# 1 2
# 2 5
# 3 6
# 4 7
# 5 10
'개발 > 알고리즘' 카테고리의 다른 글
[백준] python 8958 OX퀴즈 (0) | 2022.02.25 |
---|---|
[백준] python 2739 구구단 (0) | 2022.02.25 |
[백준] python 1018 체스판 다시 칠하기 (0) | 2022.01.24 |
[백준] python 1010 다리 놓기 (0) | 2022.01.21 |
백준 1010 javascript (node js) (0) | 2022.01.14 |
Comments