Vous êtes sur la page 1sur 13

PTK8206

An Introduction to Computer Programming

---
Mengapa belajar (pemrograman) komputer?
Computers provide tools to simplify processes
Computers allow for analysis that is otherwise
impossible
Computer science can be applied to many
problems in the sciences, business, arts,
humanities
Computers dont always do what we think
they are doing, better to understand when this
happens!
Tujuan
To learn most Python instructions.
To be able to write programs that solve scientific (or
other) problems.
To understand what computer scientists do.
To acquire an appreciation of how computer science
applies to other areas of research.
Isi
Intended for students with no
programming experience.
Introduction to
algorithms
programming using Python
Data analysis and plotting
Database design
Rujukan
Textbook ebook or hardcopy
Practical Programming 2nd Edition by Campbell,
Gries, Lockwood, Montojo
and Wilson
http://pragprog.com/book/gwpy2/practical-programming
Computer Science
Is about problem solving and writing
algorithms.

ALGORITHM (WEBSTERS).
A step-by-step procedure for solving a
problem or accomplishing some end
especially by a computer
Lets Practice Algorithms
Give the smiley face instructions to get to the star. Use
Forward, Right, Left.
F x 2, R
F x 2, L
F x 7, R
F x 2, R
F, L
F, R
F, L
F x 2, R
F x 3, R
F
Let Practice Algorithms Take 2

F x 9, R
F x 9, R
F x 9, R
F x 7, R
F x 7, R
F x 5, R
F x 5, R
F x 3, R
F x 3, R
F
Let Practice Algorithms Take 2

F x 9, R F x 9, R
F x 9, R
F x 9, R steps 9
F x 7, R (F x steps, R) x 2
F x 7, R steps 7
F x 5, R (F x steps, R) x 2
F x 5, R steps 5
F x 3, R (F x steps, R) x 2
F x 3, R steps 3
F (F x steps, R) x 2

F
Algorithms Take 2
F x 9, R F x 9, R
steps 9 steps 9

(F x steps, R) x 2 while steps > 2 repeat:


steps steps
7 -2 (F x steps, R) x 2
(F x steps, R) x 2 steps steps - 2
steps steps
5 -2
(F x steps, R) x 2
steps steps
3 -2
(F x steps, R) x 2

F F
Python

Python is the language


we will use to write our
algorithms.
Editor
We use Wing 101: a
free environment and
editor for coding in
Python. Shell
Kita pakai sumber ini:
http://www.utsc.utoronto.ca/~atafliovich/csca
20/lectures.shtml
Demokan lec1shell (wordpad )
Lihat worksheet minggu 1
Pasang wing ide 101

Vous aimerez peut-être aussi