-
Notifications
You must be signed in to change notification settings - Fork 0
/
python_qu_02.html
463 lines (460 loc) · 20.9 KB
/
python_qu_02.html
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!DOCTYPE html>
<html lang="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
.utterances {
position: relative;
box-sizing: border-box;
width: 100%;
max-width: 760px;
margin-left: auto;
margin-right: auto;
}
.utterances-frame {
color-scheme: light;
position: absolute;
left: 0;
right: 0;
width: 1px;
min-width: 100%;
max-width: 100%;
height: 100%;
border: 0;
}
</style>
<title>Python 입문</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<script src="https://kit.fontawesome.com/77ad8525ff.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://bluecow03.github.io/pythonst/python/style.css">
<link rel="stylesheet" href="https://bluecow03.github.io/pythonst/python/collapsible-chapters.css">
<link rel="stylesheet" href="https://bluecow03.github.io/pythonst/python/website.css">
<link rel="stylesheet" href="https://bluecow03.github.io/pythonst/python/search.css">
<link rel="stylesheet" href="https://bluecow03.github.io/pythonst/python/website(1).css">
<meta name="HandheldFriendly" content="true">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="./python/python.png">
<link rel="shortcut icon" href="./python/python.ico" type="image/x-icon">
<link rel="next" href="https://bluecow03.github.io/pythonst/python/python_st_00.html">
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li class="chapter active expanded" data-level="1.1" data-path="./">
<a href="https://bluecow03.github.io/pythonst/python_main.html">
Python
</a>
</li>
<li class="chapter expanded" data-level="1.2" data-path="basics/">
<a href="https://bluecow03.github.io/pythonst/python_st_00.html">
1장. Python 입문
<i class="exc-trigger fa"></i>
</a>
<ul class="articles">
<li class="chapter " data-level="1.2.1" data-path="basics/01-hello-javascript.html">
<a href="https://bluecow03.github.io/pythonst/python_st_01.html">
01. Hello Python
</a>
</li>
<li class="chapter " data-level="1.2.2" data-path="basics/02-variables.html">
<a href="https://bluecow03.github.io/pythonst/python_st_02.html">
02. 변수와 입출력
</a>
</li>
<li class="chapter " data-level="1.2.3" data-path="basics/03-operator.html">
<a href="https://bluecow03.github.io/pythonst/python_st_03.html">
03. 연산자
</a>
</li>
<li class="chapter " data-level="1.2.4" data-path="basics/04-conditions.html">
<a href="https://bluecow03.github.io/pythonst/python_st_04.html">
04. 배열
</a>
</li>
<li class="chapter " data-level="1.2.5" data-path="basics/05-function.html">
<a href="https://bluecow03.github.io/pythonst/python_st_05.html">
05. 조건문
</a>
</li>
<li class="chapter expanded" data-level="1.2.6" data-path="basics/06-object.html">
<a href="https://bluecow03.github.io/pythonst/python_st_06.html">
06. 반복문
</a>
</li>
<li class="chapter " data-level="1.2.7" data-path="basics/07-array.html">
<a href="https://bluecow03.github.io/pythonst/python_st_07.html">
07. 함수
</a>
</li>
<li class="chapter " data-level="1.2.8" data-path="basics/08-loop.html">
<a href="https://bluecow03.github.io/pythonst/python_st_08.html">
08. 객체
</a>
</li>
<li class="chapter " data-level="1.2.9" data-path="basics/09-array-functions.html">
<a href="https://bluecow03.github.io/pythonst/python_st_09.html">
09. 클래스
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3" data-path="useful/">
<a href="https://bluecow03.github.io/pythonst/python_qu_00.html">
2장. Python 간단 퀴즈
<i class="exc-trigger fa"></i>
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="useful/01-ternary.html">
<a href="https://bluecow03.github.io/pythonst/python_qu_01.html">
01. 입력을 통한 사칙연산
</a>
</li>
<li class="chapter " data-level="1.3.2" data-path="useful/02-truthy-and-falsy.html">
<a href="https://bluecow03.github.io/pythonst/python_qu_02.html">
02. if-elif문 활용
</a>
</li>
<li class="chapter " data-level="1.3.3" data-path="useful/03-short-circuiting.html">
<a href="https://bluecow03.github.io/pythonst/python_qu_03.html">
03. 반복문 활용
</a>
</li>
<li class="chapter " data-level="1.3.4" data-path="useful/04-default-function-params.html">
<a href="https://bluecow03.github.io/pythonst/python_qu_04.html">
04. 중복 반복문
</a>
</li>
<li class="chapter " data-level="1.3.5" data-path="useful/05-smarter-conditions.html">
<a href="https://bluecow03.github.io/pythonst/python_qu_05.html">
05. 반복문과 if문 혼합 사용
</a>
</li>
<li class="chapter " data-level="1.3.6" data-path="useful/06-destructuring.html">
<a href="https://bluecow03.github.io/pythonst/python_qu_06.html">
06. 함수 활용
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com/" target="blank" class="gitbook-link" style="display: none;">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<a class="btn pull-left js-toolbar-action" aria-label="" href="https://bluecow03.github.io/pythonst">
<i class="fa fa-align-justify"></i>
</a>
<a class="btn pull-right js-toolbar-action" aria-label="GitHub" href="https://bluecow03.github.io/pythonst">
<i class="fa fa-github"></i>
</a>
<a class="btn pull-left js-toolbar-action" aria-label="" href="https://bluecow03.github.io/pythonst">
<i class="fa fa-edit"></i>
수정 요청하기
</a>
<div class="dropdown pull-right js-toolbar-action">
<a class="btn toggle-dropdown" aria-label="Share" href="https://bluecow03.github.io/pythonst">
<i class="fa fa-share-alt"></i>
</a>
<div class="dropdown-menu dropdown-left">
<div class="dropdown-caret">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</div>
<div class="buttons">
<button class="button size-5 ">Facebook</button>
<button class="button size-5 ">Twitter</button>
</div>
</div>
</div>
<a class="btn pull-right js-toolbar-action" aria-label="" href="https://bluecow03.github.io/pythonst">
<i class="fa fa-facebook"></i>
</a>
<a class="btn pull-right js-toolbar-action" aria-label="" href="https://bluecow03.github.io/pythonst">
<i class="fa fa-twitter"></i>
</a>
<div class="dropdown pull-left font-settings js-toolbar-action">
<a class="btn toggle-dropdown" aria-label="Font Settings" href="https://bluecow03.github.io/pythonst">
<i class="fa fa-font"></i>
</a>
<div class="dropdown-menu dropdown-right">
<div class="dropdown-caret">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</div>
<div class="buttons">
<button class="button size-2 font-reduce">A</button>
<button class="button size-2 font-enlarge">A</button>
</div>
<div class="buttons">
<button class="button size-2 ">Serif</button>
<button class="button size-2 ">Sans</button>
</div>
<div class="buttons">
<button class="button size-3 ">White</button>
<button class="button size-3 ">Sepia</button>
<button class="button size-3 ">Night</button>
</div>
</div>
</div>
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="https://bluecow03.github.io/pythonst">Python</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="계산기">계산기</h1>
<p>
이번 퀴즈에서는 정수와 셈을 입력 받아 더하기, 빼기, 곱하기, 나누기, 나머지 중에 원하는 사칙연산을 하는 프로그램을 만들어
보도록 하겠습니다. 그러면 퀴즈를 풀기 쉽게 힌트를 하나 드리고 퀴즈를 풀어보겠습니다.<br>
사칙연산 중에 선택하는 부분은 if~elif()를 사용하면 됩니다.
</p>
<h2 id="계산기">계산기</h2>
<p>
앞에서 말씀드린 것과 같이 두번째 문제로 두 정수를 받고 더하기, 빼기, 곱하기, 나누기, 나머지 중에 선택하여 연산을
진행하는 프로그램을 만들어 보겠습니다.
</p>
<img src="./pictures/python_qu_02/qu_02_01.JPG" alt="not found" width="auto" height="auto">
<img src="./pictures/python_qu_02/qu_02_02.JPG" alt="not found" width="auto" height="auto">
<p>
위에 x의 부분에는 어떤 사칙 연산을 할것인지를 y와 z의 부분은 정수를 받아와야 합니다.
그리고 print 부분에 직접 코딩하여 아래 출력값과 동일하게 되도록 하시면 됩니다.<br>
x에 다른 값이 나오면 '사칙 연산의 입력이 잘못되어 종료 합니다.'라는 출력이 나오게 하시면 됩니다.
</p>
<p>
이번 문제의 답은 <a href="https://github.com/BlueCow03/pythonst/blob/main/answer/python_qu_02_answer/qu_02_01_answer.JPG"target='_blank'>링크</a>로 들어가시면 확인하실 수 있습니다.
</p>
<script>
function attachComments() {
const el = document.querySelector('.markdown-section');
if (!el) return;
const script = document.createElement('script');
script.src = 'https://utteranc.es/client.js';
script.setAttribute('repo', 'velopert/learnjs');
script.setAttribute('issue-term', 'title');
script.setAttribute('crossorigin', 'anonymous');
script.setAttribute('label', 'comments');
el.appendChild(script);
}
setTimeout(attachComments, 100);
</script>
<div class="utterances">
<iframe class="utterances-frame" title="Comments" scrolling="no" src="./python.html" loading="lazy"></iframe>
</div>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title">
<span class="search-results-count"></span> results matching "<span class="search-query"></span>"
</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class="search-query"></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="https://bluecow03.github.io/pythonst/python_qu_01.html" class="navigation navigation-prev " aria-label="Previous page: 01. 입력을 통한 사칙연산">
<i class="fa fa-angle-left"></i>
</a>
<a href="https://bluecow03.github.io/pythonst/python_qu_03.html" class="navigation navigation-next navigation-unique" aria-label="Next page: 03. 반복문 활용" style="margin-right: 17px;">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged(
{"page":{
"title":"Python 입문",
"level":"1.1",
"depth":1,
"next":{
"title":"1장. python 입문",
"level":"1.2",
"depth":1,
"path":"basics/README.md",
"ref":"./basics/README.md",
"articles":[{
"title":"01. Hello Python",
"level":"1.2.1",
"depth":2,
"articles":[]
},
{
"title":"02. 변수와 입출력",
"level":"1.2.2",
"depth":2,
"articles":[]
},
{
"title":"03. 연산자",
"level":"1.2.3",
"depth":2,
"articles":[]
},
{
"title":"04. 배열",
"level":"1.2.4",
"depth":2,
"articles":[]
},
{
"title":"05. 조건문",
"level":"1.2.5",
"depth":2,
"articles":[]
},
{
"title":"06. 반복문",
"level":"1.2.6",
"depth":2,
"articles":[]
},
{
"title":"07. 함수",
"level":"1.2.7",
"depth":2,
"articles":[]
},
{
"title":"08. 객체",
"level":"1.2.8",
"depth":2,
"articles":[]
},
{"title":"09. 클래스",
"level":"1.2.9",
"depth":2,
"articles":[]
}]
},
"dir":"ltr"},
"config":{
"gitbook":"*",
"theme":"default",
"variables":{},
"plugins":[
"collapsible-chapters",
"comment",
"hide-published-with",
"github",
"edit-link"
],
"pluginsConfig":{
"github":{
"url":"https://github.com/BlueCow03/pythonst"
},
"search":{},
"collapsible-chapters":{},
"lunr":{
"maxIndexSize":1000000,
"ignoreSpecialCharacters":false
},
"hide-published-with":{},
"fontsettings":{
"theme":"white",
"family":"sans",
"size":2
},
"highlight":{},
"sharing":{
"facebook":true,
"twitter":true,
"vk":false,
"all":["facebook","twitter"]
},
"edit-link":{
"label":"수정 요청하기",
"base":"https://github.com/BlueCow03/pythonst/edit/master"
},
"theme-default":{
"styles":{
"website":"styles/website.css",
"pdf":"styles/pdf.css",
"epub":"styles/epub.css",
"mobi":"styles/mobi.css",
"ebook":"styles/ebook.css",
"print":"styles/print.css"
},
"showLevel":false
},
"comment":{}
},
"structure":{
"langs":"LANGS.md",
"readme":"README.md",
"glossary":"GLOSSARY.md",
"summary":"SUMMARY.md"
},
"pdf":{
"pageNumbers":true,
"fontSize":12,
"fontFamily":"Arial",
"paperSize":"a4",
"chapterMark":"pagebreak",
"pageBreaksBefore":"/",
"margin":{
"right":62,
"left":62,
"top":56,
"bottom":56}
},
"styles":{
"website":"styles/website.css",
"pdf":"styles/pdf.css",
"epub":"styles/epub.css",
"mobi":"styles/mobi.css",
"ebook":"styles/ebook.css",
"print":"styles/print.css"}
},
"file":{
"path":"README.md",
"mtime":"2019-05-18T02:44:31.008Z",
"type":"markdown"
},
"gitbook":{
"version":"3.2.3",
"time":"2019-06-09T12:51:25.214Z"
},
"basePath":".",
"book":{"language":""}
}
);
});
</script>
</div>
<script src="https://bluecow03.github.io/pythonst/python/gitbook.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/theme.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/collapsible-chapters.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/plugin.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/plugin(1).js"></script>
<script src="https://bluecow03.github.io/pythonst/python/plugin(2).js"></script>
<script src="https://bluecow03.github.io/pythonst/python/search-engine.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/search.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/lunr.min.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/search-lunr.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/buttons.js"></script>
<script src="https://bluecow03.github.io/pythonst/python/fontsettings.js"></script>
</body>
</html>