Lecture 1
Part 1 :
Introduction to Python & Program
Development
ITE3711 - Programming Concept and Applications
Lecture 1 – Part 1
What is the Python?
Python is a popular language created by Guido van Rossum. (Released in 1991)
• Mathematics
• System scripting
• Software Development
• Web Development
• Etc.
2
Lecture 1 – Part 1
Why Python?
• Works on different platforms
• Simple syntax like the English language
• Runs on an interpreter system
• Can be treated in procedural way, an object-oriented way or a functional way
3
Lecture 1 – Part 1
Python website
http://www.python.org/
• Major version: Python 3
• Python 3.11.4 is the newest major release of the Python programming language
4
Lecture 1 – Part 1
Example of Python programming
print("Hello, World!")
This is the source code of the Python program
Python is High-level language
Output: • Designed for readability
• Has some similarities to the English language
Hello, World!
This is the output of the Python program
(Result of the program)
5
Lecture 1 – Part 1
How to check Python installation and version?
Windows PCs already installed Python
To check if Python installed on a Windows PC, running the following command in Windows Tool “Command Prompt”
(cmd.exe)
python --version
The terminal will return the version of the Python
Python 3.9.2
6
Lecture 1 – Part 1
How to install or update Python?
Download the installation file (.exe) from official download page:
https://www.python.org/downloads/
Support
• Windows
• MacOS
• Other platforms such as iOS
7
Lecture 1 – Part 1
How to install or update Python? (cont.)
Before clicking the “Install Now” button, make sure that the checkbox “Add python.exe to PATH” is checked!
Restart the PC after the installation
8
Lecture 1 – Part 1
How to edit the source file or source code?
Code editor
• Visual Studio Code (link: https://code.visualstudio.com/)
• Notepad ++
• Etc.
9
Lecture 1 – Part 1
How to edit the source file or source code?
Online simulator
• Sandbox (link: https://edube.org/sandbox)
• Etc.
Enter source code area
(No need to create source file)
10
Output of the program
Lecture 1 – Part 1
How to edit the source file or source code?
Windows tool
• Notepad
Online IDE
• Replit
• Etc.
11
Lecture 1 – Part 1
What is a computer system?
A computer cannot do anything without software
Computer System
Software
Set of instructions for the computer to process data
System software
• Windows 8
Hardware Software • Windows 10
• Windows 11
Application software
• Google Chrome
• Microsoft Edge 12
Lecture 1 – Part 1
What is a computer software?
Operating
System
System
software Software refers to a collection of instructions for the
System
Support computer to follow and execute
Computer
Software
General The computer only follows that the programmer tells it to do
purposes (source code)
Application
software
Specific
purposes
13
Lecture 1 – Part 1
Software development
Stage 1 Planning
Stage 2 Analysis Flowchart
Pseudo Code
Stage 3 Design
Programming
Stage 4 Implementation Testing
Installation
Stage 5 Maintenance
14
Lecture 1 – Part 1
Software development – Planning, Analysis and Design
Stage 1 Planning
Stage 2 Analysis Flowchart
Pseudo Code
Stage 3 Design User view:
Input Processing Output
Programmer view:
In the view of the programmer: Output Input Processing
• Determine Output – Response the processed information onto various output devices, such as screen
• Identify Input(s) – Get information (data) from various input devices, such as keyboard
• Determine necessary process to turn given Input(s) into desired Output
15
Lecture 1 – Part 1
Software development – Planning, Analysis and Design
Two tools are used to convert algorithms into computer programs
• Flowchart
Graphically depict the logical steps to carry out a task and show how the steps relate to each other
• Pseudo code
Uses English like phrases with some program terms to outline the task
16
Lecture 1 – Part 1
Software development – Planning, Analysis and Design
Flowchart
• Graphically depict the logical steps to carry out a task and show how the steps relate to each other
• Symbols of flowchart
• Input: Data
• Process: Task, operation
• Decision: Yes, No
• Terminal: Start, End
• Flow line
17
Lecture 1 – Part 1
Software development – Planning, Analysis and Design
Example of flowchart and pseudo code
Task: Calculate and display the area of the circle
• Input: radius
Ask the user for the radius
• Process: area = pi * radius squared
Convert the input to a number and stored in the variable
Calculate the area by multiplying PI by the radius squared
• Output: area
Return and display the answer (area) to user 18
Lecture 1 – Part 1
Software development – Planning, Analysis and Design
Task: Calculate and display the area of the circle
Pseudo code Flow chart Start
1. Declare variable(s)
Declare variable(s)
2. Store the user input to the variable(s)
3. Convert the input to a number Store the user input to the variable(s)
4. Calculate the area by using the formula Calculate the area by using the formula:
area = pi * radius squared
area = pi * radius squared
5. Return and display the answer (area) of the circle Return and display the answer (area) of
the circle
19
End/Stop
Lecture 1 – Part 1
Software development – Implementation
Programming
Stage 4 Implementation Testing
Installation
Steps in implementation:
Step 1 Create the source file (Rename and save the file)
Step 2 Enter source code(s)
Step 3 Save the changes (Save the changes regularly)
Step 4 Test and review the program
Step 5 Debug (if need)
20
Lecture 1 – Part 1
Software development – Implementation
Step 1 Create the source file (Rename and save the file)
1
3
5
2
21
Lecture 1 – Part 1
Software development – Implementation
Step 2 Enter source code(s)
22
Lecture 1 – Part 1
Software development – Implementation
Step 3 Save the changes (Save the changes regularly)
23
Lecture 1 – Part 1
Software development – Implementation
Step 4 Test and review the program
9
Result
24
Lecture 1 – Part 1
Software development – Implementation
Step 5 Debug (if need)
Example of Syntax error
Three types of error (the program fails to run) if 5 > 2
print("Five is greater than two!")
• Syntax error
• Run-time error
• Logic error
if 5>2
^
SyntaxError: expected ':'
25