![Page 1: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/1.jpg)
Flow Diagram II
반복구조
배열
![Page 2: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/2.jpg)
반복구조의개요
Introduction to Programming Language 2
i = 0, 9, 1 for i in range(10):
문장
초기값종료값 증가값
*.기본초기값: 0
*.기본증가값: 1
종료값 + 1
![Page 3: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/3.jpg)
반복구조의개요
• Exercise
Introduction to Programming Language 3
end없으면줄바꿈
![Page 4: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/4.jpg)
10부터 1까지출력하기
Introduction to Programming Language 4
![Page 5: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/5.jpg)
LAB: 1부터 100까지의합
Introduction to Programming Language 5
![Page 6: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/6.jpg)
LAB: 1부터 100까지의수중짝수의합• 2명이한그룹
• 반복문의시작,끝,증가값을정한다
• 순서도를작성
• 코드를작성
Introduction to Programming Language 6
![Page 7: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/7.jpg)
중첩반복구조
Introduction to Programming Language 7
![Page 8: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/8.jpg)
직각삼각형모양으로수출력하기
Introduction to Programming Language 8
![Page 9: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/9.jpg)
LAB: 구구단
Introduction to Programming Language 9
![Page 10: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/10.jpg)
리스트혹은배열
Introduction to Programming Language 10
![Page 11: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/11.jpg)
리스트란• 하나의변수로여러개의값을저장할수있는데이터형
• 변수가리스트임을표현
• a = [] # 빈리스트
• a = [1, 2, 3] # a[0]은 1, a[1]은 2, a[3]은 3
• a = [0]*10 # a[0]부터 a[9]까지모두 0
• print(a[2]) # a에첨자를꺽쇠안에넣어서표시할수있음
Introduction to Programming Language 11
0 0 0 0 0 0 0 0 0 0
a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9]
![Page 12: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/12.jpg)
배열
Introduction to Programming Language 12
![Page 13: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/13.jpg)
1부터 10까지의수저장하고출력하기
Introduction to Programming Language 13
![Page 14: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/14.jpg)
10, 20, 30, …, 100을역순으로출력
Introduction to Programming Language 14
![Page 15: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/15.jpg)
배열 a의요소를배열 b에역순으로저장하기
Introduction to Programming Language 15
a = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
![Page 16: New Flow Diagram IIopen.gnu.ac.kr/lecslides/2020-2-introProg/slides_py_pdf/... · 2018. 8. 8. · 배열에저장된 2진수를10진수로변환하기 • 2진수11001은다음과같은절차를거쳐10진수25가된다](https://reader034.vdocuments.mx/reader034/viewer/2022052104/603ea337be44cb773332ee6c/html5/thumbnails/16.jpg)
배열에저장된 2진수를 10진수로변환하기• 2진수 11001은다음과같은절차를거쳐 10진수 25가된다.
• 110012 = 1X24 + 1X23 + 0X22 + 0 X 21 + 1 X 20
= 16 + 8 + 0 + 0 + 1
= 2510
• 순서도를작성하자.
• 프로그램을작성해보자.
• Hint: b = [1,1,0,0,1]
Introduction to Programming Language 16