You are on page 1of 26

Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Week 1:
Course Overview

Spring 2017
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

교육목표

Python이라고 하는 프로그래밍 언어의 문법/의미를 익히고


간단한 수준의 알고리즘적 문제들을 Python으로 해결
타 수학/과학 정규교과 및 연구활동을 위한 유용한 도구

예: 임의의 미로를 탈출하는 방법을 Python 프로그램으로


I 마지막 수업에서 다루는 숙제

hubo.drop_beeper()
while not hubo.front_is_clear():
hubo.turn_left()
hubo.move()
while not hubo.on_beeper():
if hubo.right_is_clear():
hubo.turn_right()
hubo.move()
elif hubo.front_is_clear():
hubo.move()
else:
hubo.turn_left()
hubo.pick_beeper()
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

수업 형태: 짧은 강의시간 + 긴 실습/질문시간

물리학실험 수업처럼 강의시간이 매우 짧고, 대부분 실습시간


강의시간: 10∼30분 (실습시간: 1.5시간 이상)
강의시간에 모든 걸 다 깨우칠 수 없고 그럴 필요도 없음
I Python 언어의 표현력은 매우 방대하므로

프로그래밍은 직접 실습을 하면 쉽게 깨우칠 수 있음


강의가 필요한 심오한 내용은 1학년 과정에는 거의 없음
강의 슬라이드의 노트만 따라가면 대부분 스스로 학습 가능
百聞而不如一見 (백번 듣는 것보다 한번 경험이 효율적)

단, 실습 중에 잘 모르겠으면 바로 질문을 해야 함
효율성: 실습+질문  실습  강의
질문에 대한 짧은 답변 = 맞춤형 개별 강의  일괄적 강의
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

효율적인 학습 방식

예습
바로 다음 1주일 분량 (그 이상은 필요없고 비효율적)
수업자료의 코드를 돌려보고 의미가 뭘지 최대한 파악
I code student\Week??\Lecture폴더에 정리되어 있음
수업 슬라이드의 노트를 간단히 읽어보면 더 좋음

수업시간
짧은 강의를 통해 큰 그림 파악 및 예습한 코드 의미 확인
수업 슬라이드는 개략적 설명 부분만 우선 읽고,
나머지 자세한 부분은 문제를 풀면서 필요할 때만 참조
I ”어떤 논리를 표현해야 하는데, 이건 자료 어디에 나오지?”
I 슬라이드는 참고서로, 내용을 다 몰라도 모든 문제 해결가능
언어의 방대한 표현력에 따르는 수많은 의문점은 질문으로
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

난이도

이 과목은 컴퓨터과학을 전혀 모르는 학생을 대상으로 설계


1학년 과목은 난이도가 낮고 학습량이 많지 않음
지시대로만 하면 모두 쉽게 배우고 즐거운 기억으로 마침
예습해도 어렵다면 질문을 안해서 그런 것이니 질문을
I 수업시간에 질문하기에 시간이 부족하면 개별적 방문

영재교육원 교육 등을 통해 내용들이 익숙한 학생들에게:


Optional problem 들이 준비되어 있으니 개별적으로 방문
창의설계에 지원하거나 R&E 등 연구활동을 개별적 준비
다른 과목들의 문제를 해결 (예: 역학 시뮬레이션)
옆의 친구들을 도와줘서 명망을 쌓음
심화선택과목을 수강할 준비 (예: 수학적 사고력 배양)
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Outline

1 Topics/Plan

2 Administrivia

3 Python Tool Installation

4 Creating Simple Programs


Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Topics

Python programming language


variables, expressions, types, basic I/O
functions
if-else conditionals
for loops
while loops
lists

Problem solving using Python


toy robot
simple problems to practice language syntax
real-world algorithmic problems (elementary-level)
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Schedule (tentative)

Wk Topics Description
1 Course Overview tool Installation
2 Basic Elements variables, expressions, basic I/O
3 Functions
4 Conditionals boolean expressions, if-else
5 Boolean Functions
6 Loops #1 for/range, max/min pattern
Midterm
7 Lists
8 Loops #2 counter pattern, toy robot: basic moves
9 Loops #3 quantifiers pattern, toy robot: beepers
10 Loops #4 toy robots with while loops
11 Toy Robot autonomous moves
12 Wrapup previous years’ final exam problems
Final exam
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Calendar (subject to minor change)

Mon C1/C4 Tue C2/C6 Wed C8 Thu C3 Fri C5/C7


2/13 2/14 2/15 입학식 2/16 L1 2/17 L1
2/20 L1 2/21 L1 2/22 L1 2/23 L2 2/24 L2
2/27 L2 2/28 L2 3/1 holiday 3/2 L3 3/3 L3
3/6 L3 3/7 L3 3/8 L2 3/9 L4 3/10 L4
3/13 L4 3/14 L4 3/15 L3 3/16 L5 3/17 L5
3/20 L5 3/21 L5 3/22 L4 3/23 L6 3/24 L6
3/27 L6 3/28 L6 3/29 L5 3/30 R 3/31 R
4/3 C8-L6 4/4 Midt. 4/5 Midt. 4/6 Midt. 4/7 Midt.
4/10 L7 4/11 L7 4/12 L7 4/13 L7 4/14 L7
4/17 L8 4/18 L8 4/19 L8 4/20 L8 4/21 L8
4/24 L9 4/25 L9 4/26 L9 4/27 L9 4/28 L9
5/1 L10 5/2 L10 5/3 holiday 5/4 R 5/5 holiday
5/8 SAF 5/9 SAF 5/10 L10 5/11 L10 5/12 L10
5/15 L11 5/16 L11 5/17 holiday 5/18 holiday 5/19 holiday
5/22 holiday 5/23 holiday 5/24 L11 5/25 L11 5/26 L11
5/29 L12 5/30 L12 5/31 L12 6/1 L12 6/2 L12
6/5 Final 6/6 Final 6/7 Final 6/8 Final 6/9 Final
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Outline

1 Topics/Plan

2 Administrivia

3 Python Tool Installation

4 Creating Simple Programs


Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Logistics

Workload (subject to minor changes):


In-class problems for each class
Midterm exam: written test (1 ∼ 2 hrs)
Final exam: practical tests (3 hrs)

Text:
Every course materials posted in LMS
Reference (need not buy it): “The Practice of Computing
using Python”, W. Punch and R. Richard

Course online:
http://lms.ksa.hs.kr ⇒ Log in ⇒ 정보과학 ⇒ ...
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Grading policy

Grading table
Activities Percentages
In-class problems 30%
Midterm 20%
Final exam 40%
Attitude/Attendance 10%

Attitude:
Penalty for playing games, web surfing, insulting others, etc.

Absolute evaluation:
You won’t compete against anyone except yourself in the class.
If everyone does a good job, everyone gets an A.
I Otherwise, ...
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Outline

1 Topics/Plan

2 Administrivia

3 Python Tool Installation

4 Creating Simple Programs


Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Setting up pdf reader

If pdf files are always opened with full screen, you must
download and install Adobe reader at
get.adobe.com/kr/reader/
Associate .pdf files with Adobe reader as default program.

Feel free to ask question if you get stuck with these steps.
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Installing Python programming environment

Download from VOD either one of


win-64bit.zip (for Windows 64-bit)
win-32bit.zip (for Windows 32-bit)

Unzip the file and install (must follow this order):


1 python-win??.msi: Python interpreter
I Just execute the file (Next, Accept, Next, Next, ..)
I When the installer asks for destination directory, keep the
default C:\Python27\
2 PIL-win??.exe: Python image library
3 wingIDE.exe: development environment

Do not download/install the latest version from internet!


Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Installing library files for robot lecture

There are 5 files in the folder robot lecture.


Copy them to C:\Python27\Lib\site-packages folder
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Working folder

Make your own working folder


I e.g. D:\CS1 or 바탕화면 아래 CS1
Unzip code student.zip to your working folder
I example code in lecture slides;
I template code for in-class problems
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Starting Wing IDE

Select in your computer:


Start menu ⇒ Program ⇒ Wing IDE 101 ⇒ Wing IDE 101
시작 ⇒ 모든 프로그램 ⇒ Wing IDE 101 ⇒ Wing IDE 101
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Outline

1 Topics/Plan

2 Administrivia

3 Python Tool Installation

4 Creating Simple Programs


Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Normal Editing Mode & Interactive Mode

Wing IDE support two modes in Python:


1 Interactive mode (in Python shell)

I gives immediate feedback for each command,


while running previously fed commands in memory
2 Normal editing mode (in Editor area)
I runs .py files in the Python interpreter
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Using Interactive Mode (in Python Shell)



←-
>>> a = (1+2+3+4)/2  
←-
>>> b = (a-1)*2  
>>> c = a+b ←- 
Type in Python shell: >>> print a 
←- 
5

>>> print b, c ←- 
8 13
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Normal Editing Mode & Interactive Mode

Wing IDE support two modes in Python:


1 Interactive mode (in Python shell)

I gives immediate feedback for each command,


while running previously fed commands in memory
2 Normal editing mode (in Editor area)
I runs .py files in the Python interpreter
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Saving Python programs to files

File ⇒ New : for creating a new .py file


File ⇒ Save (or Ctrl+s) : for storing to the file
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Example: Moving around a little square

Type the following code and save it as file test.py


I in working folder (CS1\code students\Week01)

a = (1+2+3+4)/2
b = (a-1)*2
c = a+b
print a
print b, c
Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Executing a Python file


Placement Information Topics/Plan Administrivia Python Tool Installation Creating Simple Programs

Comment

a = (1+2+3+4)/2 # sum from 1 to 4


b = (a-1)*2
c = a+b

# print the values of a, b, c


print a
print b, c

""" comment can span


multiple lines """

Add comment to programs for readability


Comment does not affect the meaning of a program
Use """...""" for comment that spans multiple lines

You might also like