Python Tutorial - For Loop
Python Tutorial - For loop
Reference
์ ํ ํฌ ํ์ด์ฌ:๋ฐ์์ฉ
https://wikidocs.net/book/1
Overview
iterable์ ์ฌ์ ์ ์๋ฏธ์ ๋๊ฐ์ด ๋ฐ๋ณต๊ฐ๋ฅํ ๊ฐ์ฒด๋ฅผ ๋งํฉ๋๋ค.
list, dictionary, set, string, tuple๊ฐ iterableํ ํ์ ์ ๋๋ค.
range๋ iterable ํฉ๋๋ค.
range๋
range(์์์ซ์, ์ข ๋ฃ์ซ์, step)
์ ํํ๋ก ๋ฆฌ์คํธ ์ฌ๋ผ์ด์ฑ๊ณผ ์ ์ฌํฉ๋๋ค.range์ ๊ฒฐ๊ณผ๋ ์์์ซ์๋ถํฐ ์ข ๋ฃ์ซ์ ๋ฐ๋ก ์ ์ซ์๊น์ง ์ปฌ๋ ์ ์ ๋ง๋ญ๋๋ค.
enumerate : ๋ช ๋ฒ์งธ ๋ฐ๋ณต๋ฌธ์ธ์ง ํ์ธ ํ๊ธฐ ์ํด ์ธ๋ฑ์ค ๋ฒํธ์ ์ปฌ๋ ์ ์ ์์๋ฅผ tupleํํ๋ก ๋ฐํํฉ๋๋ค.
Examples
Was this helpful?