00 Lecture MD
00 Lecture MD
00 Lecture MD
Programming
Lecture slides - Introduction to Programming
○ Overview of Python
○ Expressions
○ Errors
Overview of the Module
● Third generation languages are the most commonly used, they include -
● Although 4GLs are seen as more advanced than 3GLs, they are not a direct
replacement, especially for general purpose problems
Python - A Popular 3GL
● Python is easier to learn than many other languages and is widely used in
education and industry
● You will have to learn the basics of how to use the Interpreter, but what you
are really trying to learn is how to program in Python
● Later on within the module you will write programs using a text editor then
execute the program files using the interpreter
● Other environments such as Jupyter Notebook, along with IPython are often
used during teaching (and may be referred to in books etc.)
● Don’t get confused between the various environments and the language
The “Python” Interpreter
○ Command history
Python Interpreter - example screen
● These lecture notes (along with the associated tutorials and exercises) will
be made available for download for use away from the University
● The provided notes will assume you are using Python version 3.7 or later.
● Any text editor can be used to develop programs later in the module
Python Libraries
● Logical errors occur during run-time, and can be hard to find and fix
○ These occur when a program is syntactically correct, but the underlying algorithm was
incorrectly designed or poorly implemented
● People new to programming spend most of their time fixing syntax errors
● The development tools will report these (often prior to program execution),
so ensure you read the error report and then fix the error
● Logical errors do not always result in an error being reported, and have to
be identified through testing
● Occasionally errors will be reported at run-time, and displayed as a
“traceback” message. Although they may seem cryptic these allow the
problem to be identified and fixed
● A good program will be written in a way that prevents such run-time errors
occuring, or reports them gracefully to the user
Summary
● Libraries are very useful and save a lot of time, but only start to use these
once you understand the language itself