-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfor_example.py
More file actions
47 lines (37 loc) ยท 1022 Bytes
/
Copy pathfor_example.py
File metadata and controls
47 lines (37 loc) ยท 1022 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
'''
for๋ฌธ์ด๋?
- ๊ฐ์ ์์
์ ์ฌ๋ฌ๋ฒ ๋ฐ๋ณตํด์ผํ ๊ฒฝ์ฐ ์ฌ์ฉ
๊ธฐ๋ณธ ๊ตฌ์กฐ
*๋ค์ฌ์ฐ๊ธฐ๋ฅผ ์ฃผ์ํ ๊ฒ
for ๋ณ์ in ๋ฆฌ์คํธ(๋๋ ํํ, ๋ฌธ์์ด) :
์ํํ ๋ฌธ์ฅ1
์ํํ ๋ฌธ์ฅ2
...
*๊ฐ์ฅ ๋ง์ด ์ฌ์ฉํ๋ for๋ฌธ์ ๊ตฌ์ฑ
for i in range(0,10) :
์ํํ ๋ฌธ์ฅ1
์ํํ ๋ฌธ์ฅ2
...
range๋ ๋ฌด์์ธ๊ฐ
- range๋ ๊ดํธ์์ ๋ค์ด๊ฐ๋ ์ซ์๋งํผ ์ฐ์๋ ์ซ์๋ฅผ ๋ง๋ค์ด์ฃผ๋ ํจ์์ด๋ค.
- ex) range(5) -> [0,1,2,3,4]
- ex) range(1,8) -> [1,2,3,4,5,6,7]
'''
def example() :
x = int(input())
for i in range(x) :
print("*"*5)
if __name__ == "__main__" :
example()
'''
๋ฌธ์
- ์์ ์ฝ๋๋ฅผ ์์ ํด์ ์
๋ ฅ๋ฐ์ ์ซ์๋งํผ ์ง๊ฐ์ผ๊ฐํ์ผ๋ก ๋ณ์ ์ฐ๋ ํ๋ก๊ทธ๋จ์ ๊ตฌํํด ๋ณด์ธ์!
์
๋ ฅ์์
>>> ์ผ๊ฐํ์ ์ค ๊ฐฏ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์ : 5
์ถ๋ ฅ์์
*
**
***
****
*****
'''