Introduction to programming: Python

This is supplementary material for Prabhas' Section.

Learning programming is like learn to swim.  You can not swim by just listen to a lecture!  Go to the pool and enjoy the practice :-)


input from programmers to IDLE is shown in  Courier font

for c in input

output from IDLE is shown in Italics

Hello World

Links to presentation used in the class


week 1   Introduction to Python language
week 2   Simple statements
week 3   Condition and Loop     review of condition and loops
week 4   Strings and Files    worksheet for week 4
week 5   list    string review  and simple list and list comprehension
week 6 
    Review    Tutorial 1   input4.txt  input5.txt  input6.txt  input7.txt  input8.txt  input9.txt
    Solution to Tutorial 1  exercise 3, 5, 7
week 7  Aj Somchai Prasitjutrakul  (list, tuple dict)
week 8
week 9  Function      Function (new slide by Aj. Somchai)    exercise
week 10  Recursion    Recursion with List   exercise
week 11   Scientific Numerical Package  (NumPy)   Numpy lecture (new slide by Aj. Somchai)
     How to install NumPy and matplotlib
week 12   Use NumPy:  Image processing 
     example images:  democracy monumentChulalongkorn
     example programs: 
        sin plot   (   bar graph  (  data   sales.csv
        grayscale image  (   convert to gray (
        compress image  (
        convolution   blur image  (
week 13   Object, Class       


The simplest installation is here.  We use Python 3 in the class. You just click the latest download (default is 32-bit).  But if you want 64-bit system, please visit this page (for windows).  Select the "Windows x86-64 web-based installer" link.  Once you install the Python system, the programming environment application will be available.  It is called IDLE.  You can find it in the start menu.

How to install NumPy and matplotlib

Other resources

Aj Somchai Prasitjutrakul has uploaded his video lecture. You can find them here. (excellent quality!)

You can write a program and watch how it runs step-by-step, completely with visualizing values of all variables. (select Python version 3.x)

Here is a tutoring Python website.  It is organised by your CP senior students.  You can also find personal tutors there too!  Give it a try.

last update 18 Apr 2016