FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PythonStudy/control_statement/for_statement.py at master · Dalguring/PythonStudy · GitHub
Dalguring
/
PythonStudy
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PythonStudy
/
control_statement
/
for_statement.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
76 lines (59 loc) · 1.41 KB
Breadcrumbs
PythonStudy
/
control_statement
/
for_statement.py
Copy path
File metadata and controls
76 lines (59 loc) · 1.41 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# for문
"""
for 변수 in 리스트 or 튜플 or 문자열:
수행할_문장1
수행할_문장2
의 형태
"""
test_list
=
[
'one'
,
'two'
,
'three'
]
for
i
in
test_list
:
print
(
i
)
a
=
[(
1
,
2
), (
3
,
4
), (
5
,
6
)]
for
(
first
,
last
)
in
a
:
print
(
first
+
last
)
marks
=
[
90
,
25
,
67
,
45
,
80
]
number
=
0
for
mark
in
marks
:
number
+=
1
if
mark
>=
60
:
print
(
"%d번 학생은 합격입니다."
%
number
)
else
:
print
(
"%d번 학생은 불합격입니다."
%
number
)
marks
=
[
90
,
25
,
67
,
45
,
80
]
number
=
0
for
mark
in
marks
:
number
+=
1
if
mark
<
60
:
continue
print
(
"%d번 학생 합격입니다."
%
number
)
# range 함수
a
=
range
(
10
)
print
(
a
)
a
=
range
(
1
,
11
)
# range의 두 번째 파라미터는 포함되지 않음
print
(
a
)
add
=
0
for
i
in
range
(
1
,
11
):
add
+=
i
print
(
add
)
marks
=
[
90
,
25
,
67
,
45
,
80
]
for
number
in
range
(
len
(
marks
)):
if
marks
[
number
]
<
60
:
continue
print
(
"%d번 학생 축하합니다. 합격입니다."
%
(
number
+
1
))
# 구구단
for
i
in
range
(
2
,
10
):
for
j
in
range
(
1
,
10
):
print
(
i
*
j
,
end
=
" "
)
print
(
''
)
# 리스트 컴프리헨션 [ 표현식 for 항목 in 반복_가능_객체 if 조건문 ]
a
=
[
1
,
2
,
3
,
4
]
result
=
[]
for
num
in
a
:
result
.
append
(
num
*
3
)
print
(
result
)
a
=
[
1
,
2
,
3
,
4
]
result
=
[
num
*
3
for
num
in
a
]
print
(
result
)
a
=
[
1
,
2
,
3
,
4
]
result
=
[
num
*
3
for
num
in
a
if
num
%
2
==
0
]
print
(
result
)
Back
|
FazBrowse Home
|
New Git URL