Introduction
Welcome to the course!
The course is to help you learn the basics of computer programming and the Python programming language and is geared towards spatial analysis and modelling.
The learning resources are a set Web pages. The [outline] gives the general structure.
"Lecture" Web pages are for you to work through and revisit in your own time as your understanding develops. They contain quiz questions which are to help you think through issues. (This page is the first lecture.)
At the bottom of each lecture there is a summary of the key concepts which are also linked from the [outline].
The key to learning computer programming is to practice. Each lecture is paired with a "practical" to help you learn. There are also additional suggested activities that may help you think through issues and learn. Each lecture covers more and in more detail than is necessary for the practicals. The general advice is to go through the lecture once without following very many links, but then after attempting the practical, do some additional study. A good way to learn is to go through everything more than once. As a 15 credit module, you are expected to spend 150 hours studying this course. It is sensible to keep a track of how much time you spend on this course and on individual activities.
Here is a more lecture like introduction to the course:
Introduction (powerpoint)
The slides to the left include an audio track for each slide. This may take some time to load if you are on a slow internet connection. Powerpoint versions are available to download (which have the audio track in the notes). The course outline has a full list of these.
The following is a quiz. They are not formally assessed.
If you choose the wrong answer the question should flash red.
If you get the correct answer an explanation as to why it is the correct answer should appear in green.
Note that if you go to any links off the lecture page any quizzes will reset.
|
Drag the right answer into the underlined area to complete the quiz.
The following code from the lecture (in the above slides) ________________________________________
value = 2
answer = 4 + value
if answer > 0 :
print (answer)
- prints "6" to the screen.
- prints "4 + value" to the screen.
- prints "2" to the screen.
Correct! As mentioned in the lecture, "value" is a label attached to a number; when you use "value" you get the number 2. The "answer" label is then attached to the number 2 + 4, and printed.
The presentation to the right goes into some detail about the history of computing languages.
What is programming? (powerpoint)
Further info:
To work productively, programmers have to be able to communicate with each other using a common set of terms. Many terms are generic, many others are specific to a particular programming language. Some language terms are synonymous, for example, "methods" in Java are the same as "functions" in Python.
Example code from the lecture: imperative.py and functional.py
References:
Ousterhout, John (1998) Scripting: Higher Level Programming for the 21st Century IEEE Computer magazine.
van Rossum, Guido (undated) Why was Python created in the first place? General Python FAQ.
van Rossum, Guido (2009) Python's Design Philosophy The History of Python blog.
Quiz: A standard compiler converts code from ________________________________________
- human readable text to machine readable binary instructions.
- human readable text to a running program.
- a runable program to human readable text.
Correct! But remember that Python is an interpreted language – it doesn't generally generate a binary file you can run separately from the source code. The interpreter does compile the source code, but into bytecode which is then run on a virtual machine, and it does this every time the code is run (unlike a compiled binary, which is generated once and can be run multiple times).
The practice of programming (powerpoint)
Further info:
- Standard Python homepage
- Anaconda homepage
- PyPI - a place to find extra Python libraries and applications
- Python 3 documentation site
- Python code for adding 3 numbers
Head back to the Course Home Page and work through the Intro Practical. Afterwards browse through the [in depth discussion of issues].