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 | 29 | 30 | 31 |
Tags
- Python
- leetcode977
- 커스텀알림
- nvmrc
- JS
- Spread
- mac
- Next.js
- 구조분해할당
- 타입스크립트
- 프로토타입
- iP
- react-native
- 자바스크립트
- 기초
- youtube iframe
- 커스텀알락
- react-firebaseui
- Rest
- 파이썬
- css
- nvm
- 리액트
- React
- firebaseui
- 파이어베이스로그인
- leetcode189
- yarn-berry
- 다리놓기
- 백준
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