-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_d01_hwrk.py
More file actions
222 lines (218 loc) · 3.24 KB
/
Copy pathpython_d01_hwrk.py
File metadata and controls
222 lines (218 loc) · 3.24 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> print("그냥 따라하기")
그냥 따라하기
>>>
>>> print(10)
10
>>>
>>> print(10, 20, 30)
10 20 30
>>>
>>> print(10 20 30)
SyntaxError: invalid syntax
>>> print(2.7)
2.7
>>>
>>> print(2.5, 7.4, 90.56)
2.5 7.4 90.56
>>>
>>> print("정수를 출력합니다")
정수를 출력합니다
>>>
>>> 10
10
>>>
>>> 10, 30, 50
(10, 30, 50)
>>>
>>> 100 200 300
SyntaxError: invalid syntax
>>>
>>> type(10)
<class 'int'>
>>>
>>> type(-35)
<class 'int'>
>>>
>>> type(2000)
<class 'int'>
>>>
>>> type(50), type(70), type(100)
(<class 'int'>, <class 'int'>, <class 'int'>)
>>>
>>> type(3, 5, 7)
Traceback (most recent call last):
File "<pyshell#27>", line 1, in <module>
type(3, 5, 7)
TypeError: type.__new__() argument 1 must be str, not int
>>>
>>> print("실수를 출력합니다")
실수를 출력합니다
>>>
>>> 2.5
2.5
>>> type(3.5)
<class 'float'>
>>>
>>> print(2.5, 3.5, 6.78)
2.5 3.5 6.78
>>>
>>> print(5.6)
5.6
>>>
>>> "문자열을 출력합니다"
'문자열을 출력합니다'
>>>
>>> 서울
Traceback (most recent call last):
File "<pyshell#40>", line 1, in <module>
서울
NameError: name '서울' is not defined
>>> "서울"
'서울'
>>>
>>> '서울'
'서울'
>>>
>>> print("\' '" 같아요")
SyntaxError: invalid syntax
>>> print("\'\"같아요")
'"같아요
>>> '"같아요
SyntaxError: EOL while scanning string literal
>>>
>>> print("\'\"같아요")
'"같아요
>>> print("서울", "부산", "광주")
서울 부산 광주
>>>
>>> "울산", "여수", "제주"
('울산', '여수', '제주')
>>>
>>> type("대한민국")
<class 'str'>
>>>
>>> type('korea')
<class 'str'>
>>>
>>>
>>> print("양주종코딩스쿨")
양주종코딩스쿨
>>>
>>> print("코딩 파이썬 3일차 - 정수와 사칙 연산")
코딩 파이썬 3일차 - 정수와 사칙 연산
>>>
>>> 20
20
>>> 50
50
>>>
>>> 20, 30, 50, 100
(20, 30, 50, 100)
>>>
>>> 10 20 30
SyntaxError: invalid syntax
>>>
>>> 20+30
50
>>> 50-20
30
>>> 20/4
5.0
>>> 20//4
5
>>> 10/3
3.3333333333333335
>>> 10%3
1
>>> 20%3
2
>>> 20%2
0
>>>
>>> 2*2
4
>>> 2*5
10
>>> 2*3
6
>>> 2**3
8
>>> 2**4
16
>>> 2*8
16
>>> 2*10
20
>>> 2**10
1024
>>>
>>>
>>> "잘보세요"
'잘보세요'
>>> "중요합니다"
'중요합니다'
>>> for i in range(0,22):
print(2,"^",i,"=","2**i)
SyntaxError: EOL while scanning string literal
>>> for i in range(0,11):
print(2, "^", i, "=", 2**i)
2 ^ 0 = 1
2 ^ 1 = 2
2 ^ 2 = 4
2 ^ 3 = 8
2 ^ 4 = 16
2 ^ 5 = 32
2 ^ 6 = 64
2 ^ 7 = 128
2 ^ 8 = 256
2 ^ 9 = 512
2 ^ 10 = 1024
>>>
>>> 2**8
256
>>>
>>> 2**16
65536
>>> 2**24
16777216
>>> 2**32
4294967296
>>>
>>> 2**10
1024
>>>
>>> 2**20
1048576
>>> 2**30
1073741824
>>> 2**40
1099511627776
>>> 2**50
1125899906842624
>>>
>>> print("복습합니다")
복습합니다
>>> 2*3
6
>>> 2**3
8
>>> 2**4
16
>>> 100/34
2.9411764705882355
>>>
>>> 100/3
33.333333333333336
>>> 100//3
33
>>> 10%3
1
>>>
>>> 2**8
256
>>>
>>> 2**10
1024
>>>