Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
Bloginfoheap Bloginfoheap Bloginfoheap

A One-Stop Repository Of Tech Blogs

Bloginfoheap Bloginfoheap Bloginfoheap

A One-Stop Repository Of Tech Blogs

  • Home
  • Categories
    • AI
    • Web3
    • Python
    • Training
    • How tos
    • Banking
    • Tech Daily
    • Gadgets Review
    • Research Guidelines
    • Internet & Networking
    • Cybersecurity & Privacy
    • Data Structures & Algorithms
  • About
  • Contact
  • Home
  • Categories
    • AI
    • Web3
    • Python
    • Training
    • How tos
    • Banking
    • Tech Daily
    • Gadgets Review
    • Research Guidelines
    • Internet & Networking
    • Cybersecurity & Privacy
    • Data Structures & Algorithms
  • About
  • Contact
Close

Search

  • Facebook
  • Twitter
  • Telegram
  • Youtube
Subscribe
Bloginfoheap Bloginfoheap Bloginfoheap

A One-Stop Repository Of Tech Blogs

Bloginfoheap Bloginfoheap Bloginfoheap

A One-Stop Repository Of Tech Blogs

  • Home
  • Categories
    • AI
    • Web3
    • Python
    • Training
    • How tos
    • Banking
    • Tech Daily
    • Gadgets Review
    • Research Guidelines
    • Internet & Networking
    • Cybersecurity & Privacy
    • Data Structures & Algorithms
  • About
  • Contact
  • Home
  • Categories
    • AI
    • Web3
    • Python
    • Training
    • How tos
    • Banking
    • Tech Daily
    • Gadgets Review
    • Research Guidelines
    • Internet & Networking
    • Cybersecurity & Privacy
    • Data Structures & Algorithms
  • About
  • Contact
Close

Search

  • Facebook
  • Twitter
  • Telegram
  • Youtube
Subscribe
Introduction to computer programming
PythonTech DailyTraining

Python Fundamentals for Beginners: Introduction to Computer Programming

September 8, 2026 22 Min Read
1
Show Table of Contents
Hide Table of Contents
  • 1. INTRODUCTION
  • 2. WHAT IS A COMPUTER PROGRAM?
    • Real-World Analogy: A Cooking Recipe
    • Example One: Student Grade Program
    • Example Two: ATM Withdrawal Program
  • 3. WHAT IS PROGRAMMING?
    • Real-World Analogy: Giving Directions
    • Example
  • 4. WHO IS A PROGRAMMER?
    • Major Responsibilities of a Programmer
    • Real-World Analogy: An Architect and a Builder
    • Important Qualities of a Good Programmer
  • 5. WHAT IS A PROGRAMMING LANGUAGE?
    • Programming Language Syntax
    • Programming Language Semantics
  • 6. WHY HUMANS NEED PROGRAMMING LANGUAGES
    • Real-World Analogy: A Human Translator
    • Reasons Humans Need Programming Languages
  • 7. LOW-LEVEL AND HIGH-LEVEL PROGRAMMING LANGUAGES
    • 7.1 Low-Level Programming Languages
    • Machine Language
    • Advantages of Machine Language
    • Disadvantages of Machine Language
    • Assembly Language
    • Uses of Low-Level Languages
    • 7.2 High-Level Programming Languages
    • Advantages of High-Level Languages
    • Disadvantages of High-Level Languages
    • 7.3 Comparison of Low-Level and High-Level Languages
    • Real-World Analogy: Manual and Automatic Transmission
  • 8. SOURCE CODE AND MACHINE CODE
    • Source Code
    • Machine Code
  • 9. WHAT IS AN INTERPRETER?
    • How an Interpreter Works
    • Real-World Analogy: A Live Language Interpreter
    • Advantages of an Interpreter
    • Disadvantages of an Interpreter
    • Example of an Interpreted Interaction
  • 10. WHAT IS A COMPILER?
    • How a Compiler Works
    • Real-World Analogy: Translating an Entire Book
    • Advantages of a Compiler
    • Disadvantages of a Compiler
  • 11. DIFFERENCE BETWEEN AN INTERPRETER AND A COMPILER
    • Important Clarification
    • 12. PYTHON AS AN INTERPRETED LANGUAGE
    • What Happens in Standard Python Execution?
    • Benefits of Python's Execution Model
  • Example
  • 13. ALGORITHMS AND PROGRAMS
    • What Is an Algorithm?
    • Real-World Analogy: Directions to a Destination
    • 13.1 Characteristics of a Good Algorithm
    • 1. Input
    • 2. Output
    • 3. Definiteness
    • 4. Finiteness
    • 5. Effectiveness
    • 6. Correctness
    • 7. Order
    • 13.2 Example Algorithm One: Calculate the Sum of Two Numbers
    • Problem
    • Algorithm
    • Input
    • Processing
    • Output
    • Program Representation
    • 13.3 Example Algorithm Two: Determine Whether a Student Passed
    • Problem
    • Algorithm
    • Input
    • Processing
    • Output
    • Program Representation
  • 14. DIFFERENCE BETWEEN AN ALGORITHM AND A PROGRAM
    • Real-World Analogy: Building Plan and Completed Building
  • 15. METHODS OF REPRESENTING AN ALGORITHM
    • 15.1 Natural Language
    • 15.2 Pseudocode
    • 15.3 Flowchart
  • 16. INPUT, PROCESSING, AND OUTPUT
    • Input
    • Processing
    • Output
    • Example: School Result System
    • Input
    • Processing
    • Output
    • Real-World Analogy: A Fruit Blender
  • 17. COMMON APPLICATIONS OF PROGRAMMING
    • 17.1 Web Development
    • 17.2 Mobile Application Development
    • 17.3 Desktop Application Development
    • 17.4 Data Analysis
    • 17.5 Artificial Intelligence and Machine Learning
    • 17.6 Automation
    • Example
    • 17.7 Banking and Financial Technology
    • 17.8 Healthcare
    • 17.9 Education
    • 17.10 Transportation
    • 17.11 Communication
    • 17.12 Entertainment and Gaming
    • 17.13 Cybersecurity
    • 17.14 Scientific Research
    • 17.15 Robotics and Embedded Systems
  • 18. THE BASIC PROGRAM DEVELOPMENT PROCESS
    • Stage One: Define the Problem
    • Stage Two: Analyze the Requirements
    • Stage Three: Design the Solution
    • Stage Four: Write the Code
    • Stage Five: Test the Program
    • Stage Six: Debug the Program
    • Stage Seven: Document the Program
    • Stage Eight: Deploy the Program
    • Stage Nine: Maintain the Program
  • 19. PROGRAMMING ERRORS AND DEBUGGING
    • 19.1 Syntax Errors
    • 19.2 Runtime Errors
    • 19.3 Logical Errors
    • Real-World Analogy: An Incorrect Address
  • 20. HOW COMPUTERS FOLLOW INSTRUCTIONS
    • Example

1. INTRODUCTION

Computers are used in almost every area of modern life.

They are found in schools, banks, hospitals, offices, airports, supermarkets, factories, and homes.

This demonstrates the role of computer programming.

However, a computer does not naturally understand human intentions. A computer cannot independently decide to calculate examination results. It cannot independently decide to send an email, recommend a video, process a payment, or display a website. It must first be given a clear set of instructions.

These instructions are called a computer program.

Programming is therefore the process through which humans tell computers what tasks to perform and how those tasks should be performed.

For example, when a student uses a calculator application to add two numbers, the calculator does not understand mathematics.

However, it does not understand mathematics in the same way a human does.

A programmer practicing computer programming previously wrote instructions that tell the application to add numbers.

  1. Accept the first number.
  2. Accept the second number.
  3. identify the mathematical operation selected.
  4. Perform the calculation.
  5. Display the result.

Without these programmed instructions, the calculator cannot function.

Therefore, it fails.

2. WHAT IS A COMPUTER PROGRAM?

A computer program is an organized set of instructions written to make a computer perform a particular task or solve a particular problem.

A computer program tells the computer:

  • What data to accept
  • What operation to perform
  • What decisions to make
  • What information to store
  • What result to display
  • When to repeat an operation
  • When to stop executing

A program may contain only a few instructions, or it may contain millions of instructions.

For example, a very small program may display a welcome message:

print("Welcome to Python Programming")

A much larger program may control:

  • A banking application
  • An airline reservation system
  • A hospital management system
  • A social media platform
  • An online shopping website
  • A mobile payment application

Real-World Analogy: A Cooking Recipe

A computer program can be compared to a cooking recipe.

A recipe contains a set of instructions such as:

  1. Wash the rice.
  2. Add water to a pot.
  3. Place the pot on the cooker.
  4. Add the rice when the water begins to boil.
  5. Cook for a specified period.
  6. Serve the food.

In the same way, a computer program contains instructions that a computer follows in a particular order.

In this analogy:

  • The recipe is the program.
  • The cook is the computer.
  • The ingredients are the input.
  • The cooking activities are the processing.
  • The prepared food is the output.

A poor or incomplete recipe may produce an undesirable meal. Similarly, incorrect programming instructions may produce a wrong result.

Example One: Student Grade Program

A student grade program may receive a score of 75.

The program may contain the following instructions:

  1. Accept the student’s score.
  2. Compare the score with the grading conditions.
  3. If the score is between 70 and 100, assign grade A.
  4. Display the grade.

The program may produce:

Score: 75
Grade: A
Remark: Excellent

Example Two: ATM Withdrawal Program

An ATM withdrawal program may perform the following tasks:

  1. Ask the customer to insert a bank card.
  2. Request the customer’s PIN.
  3. Verify the PIN.
  4. Display available banking options.
  5. Accept the withdrawal amount.
  6. Check whether the customer has sufficient funds.
  7. Release the money.
  8. Update the account balance.
  9. Print or display a receipt.

All these operations are controlled by computer programs.

Read also:

  • Understanding Variables and Assignments in Python
  • Python Syntax Rules and Code Structure
  • Introduction to Python Programming Concepts

3. WHAT IS PROGRAMMING?

Programming is the process of designing, writing, testing, correcting, and maintaining instructions that a computer can execute.

Programming is not limited to typing code. It involves several activities, including:

  1. Understanding a problem
  2. Identifying the required input
  3. Determining the expected output
  4. Designing a solution
  5. Writing the instructions in a programming language
  6. Testing the instructions
  7. Finding and correcting errors
  8. Improving the program
  9. Maintaining the program after it has been released

Programming may also be called coding, although the two terms can have slightly different meanings.

  • Coding mainly refers to writing instructions in a programming language.
  • Programming includes coding, problem analysis, design, testing, debugging, documentation, and maintenance.

Therefore, coding is an important part of programming, but programming is broader than coding.

Real-World Analogy: Giving Directions

Imagine that a visitor wants to travel from a bus station to a school.

You may give the following directions:

  1. Leave the bus station through the main gate.
  2. Turn right.
  3. Walk straight for 500 meters.
  4. Turn left at the bank.
  5. Continue until you see the school gate.

These directions must be clear and arranged in the correct order.

A computer program works in a similar way. The programmer gives the computer step-by-step instructions. If the instructions are unclear, incomplete, or arranged incorrectly, the computer may not produce the expected result.

Example

Suppose a programmer wants to create a program that calculates the area of a rectangle.

The formula is:

Area = Length × Width

The programming process may involve:

  1. Asking the user to enter the length.
  2. Asking the user to enter the width.
  3. Multiplying the length by the width.
  4. Displaying the result.

A simple Python version may be written as:

length = 10
width = 5
area = length * width

print(area)

The output will be:

50

4. WHO IS A PROGRAMMER?

A programmer is a person who designs, writes, tests, corrects, and maintains computer programs.

A programmer uses programming languages to create instructions that computers can understand and execute.

Programmers may also be called:

  • Software developers
  • Software engineers
  • Application developers
  • Web developers
  • Mobile application developers
  • Game developers
  • Systems programmers
  • Data engineers
  • Automation engineers

These titles may involve different responsibilities, but they all require some knowledge of programming.

Major Responsibilities of a Programmer

A programmer may be responsible for:

  1. Understanding a problem that needs a technological solution.
  2. Designing a logical method for solving the problem.
  3. Writing program instructions.
  4. Testing the program with different inputs.
  5. Identifying and correcting errors.
  6. Improving the speed and efficiency of the program.
  7. Protecting the program from security threats.
  8. Updating the program when requirements change.
  9. Writing documentation.
  10. Working with designers, analysts, testers, managers, and users.

Real-World Analogy: An Architect and a Builder

A programmer may be compared to an architect and a builder.

An architect first studies what a building should contain. The architect then prepares a plan showing where rooms, doors, windows, and other components should be placed.

The builder follows the plan to construct the building.

Similarly, a programmer:

  • Studies a problem
  • Plans a solution
  • Writes the instructions
  • Tests the final system

A well-designed building requires a clear plan. A reliable computer program also requires careful planning.

Important Qualities of a Good Programmer

A good programmer should develop:

  • Logical thinking
  • Problem-solving ability
  • Patience
  • Attention to detail
  • Curiosity
  • Creativity
  • Willingness to learn
  • Ability to test assumptions
  • Ability to communicate ideas
  • Ability to learn from errors

A programmer does not need to memorize every programming command. It is more important to understand how to solve problems logically and know how to find reliable information.

5. WHAT IS A PROGRAMMING LANGUAGE?

A programming language is a formal language used by humans to write instructions that a computer can translate and execute.

Programming languages contain:

  • Words
  • Symbols
  • Rules
  • Commands
  • Structures

These elements allow programmers to describe tasks in a form that can eventually be converted into machine instructions.

Examples of programming languages include:

  • Python
  • C
  • C++
  • Java
  • JavaScript
  • C#
  • PHP
  • Swift
  • Kotlin
  • Go
  • Rust
  • Ruby

Each programming language has its own rules and areas where it is commonly used.

For example:

  • Python is widely used in automation, artificial intelligence, web development, and data analysis.
  • JavaScript is commonly used to make websites interactive.
  • Java is used in enterprise systems and some Android applications.
  • Swift is used for applications on Apple devices.
  • C is widely used in operating systems, embedded systems, and low-level software.

Programming Language Syntax

The rules that determine how instructions must be written in a programming language are called syntax.

For example, the following is valid Python syntax:

print("Hello")

The following is incorrect:

print("Hello"

The second instruction is incorrect because the closing parenthesis is missing.

This type of mistake is called a syntax error.

Programming Language Semantics

Semantics refers to the meaning of an instruction.

A statement may be written correctly according to the syntax rules but may still produce the wrong result because its meaning or logic is incorrect.

For example:

length = 10
width = 5
area = length + width

This code is syntactically valid, but it is logically wrong because the area of a rectangle should be calculated through multiplication, not addition.

The correct instruction is:

area = length * width

6. WHY HUMANS NEED PROGRAMMING LANGUAGES

Computers and humans communicate differently.

Humans communicate using languages such as:

  • English
  • Igbo
  • Hausa
  • Yoruba
  • French
  • Spanish

Computers operate using electrical signals represented by binary digits:

0 and 1

At the hardware level:

  • 0 may represent an off or low electrical state.
  • 1 may represent an on or high electrical state.

A computer’s processor understands instructions represented in machine language. Writing complete applications directly in binary would be extremely difficult, slow, and likely to produce many errors.

Programming languages provide a bridge between human reasoning and machine operations.

Real-World Analogy: A Human Translator

Imagine two people who do not speak the same language.

  • Person A speaks only English.
  • Person B speaks only French.

They may require a translator to communicate.

Similarly:

  • The programmer thinks using human concepts.
  • The computer understands machine instructions.
  • The programming language and translation system help connect them.

A programmer may write:

print("Welcome")

The computer does not execute the English word print directly. The instruction must eventually be translated into lower-level instructions that the processor can execute.

Reasons Humans Need Programming Languages

Programming languages are needed because they:

  1. Make instructions easier for humans to read.
  2. Reduce the difficulty of writing programs.
  3. Allow programmers to solve complex problems.
  4. Reduce the number of errors compared with writing binary instructions.
  5. Allow programs to be organized into understandable sections.
  6. Make programs easier to test and maintain.
  7. Allow code to be reused.
  8. enable programmers to work together.
  9. Provide commands for performing common operations.
  10. Allow one program to work on different computer systems.

7. LOW-LEVEL AND HIGH-LEVEL PROGRAMMING LANGUAGES

Programming languages can generally be grouped into:

  1. Low-level programming languages
  2. High-level programming languages

7.1 Low-Level Programming Languages

A low-level programming language is a language that is close to the computer’s hardware and machine instructions.

Low-level languages provide direct control over the processor, memory, and other hardware components.

The two main forms are:

  1. Machine language
  2. Assembly language

Machine Language

Machine language is the lowest-level programming language. It is made up of binary instructions containing zeros and ones.

An example may appear as:

10110000 01100001

Machine language is directly understood by a computer’s processor.

Advantages of Machine Language

  • It can be executed directly by the processor.
  • It can provide high performance.
  • It gives direct control over computer hardware.

Disadvantages of Machine Language

  • It is extremely difficult for humans to read.
  • It is difficult to write.
  • It is difficult to correct.
  • It is specific to a particular processor.
  • A small mistake can be difficult to identify.
  • Large programs would require enormous effort.

Assembly Language

Assembly language uses short symbolic instructions instead of only zeros and ones.

Examples of assembly-style instructions include:

MOV
ADD
SUB
JMP

Assembly language is easier to understand than machine language, but it is still closely connected to the computer’s hardware.

An assembler translates assembly language into machine language.

Uses of Low-Level Languages

Low-level programming may be used in:

  • Operating-system components
  • Device drivers
  • Embedded systems
  • Microcontrollers
  • Hardware control
  • Performance-critical systems
  • Firmware

7.2 High-Level Programming Languages

A high-level programming language is designed to be easier for humans to read, write, and understand.

Examples include:

  • Python
  • Java
  • C#
  • JavaScript
  • PHP
  • Ruby
  • Swift

A high-level instruction may look like this:

total = price * quantity

The meaning is easier for a human to understand than a sequence of binary digits.

Advantages of High-Level Languages

  • Easier to learn
  • Easier to read
  • Easier to write
  • Easier to test
  • Easier to correct
  • Suitable for developing large applications
  • Often usable on different computer systems
  • Requires fewer instructions than machine language
  • Supports reusable program components

Disadvantages of High-Level Languages

  • They require translation before execution.
  • They may provide less direct hardware control.
  • Some may be slower than carefully optimized low-level programs.
  • They may require supporting software such as interpreters or runtime environments.

7.3 Comparison of Low-Level and High-Level Languages

FeatureLow-Level LanguageHigh-Level Language
Relationship to hardwareVery close to hardwareCloser to human language
Ease of learningDifficultEasier
ReadabilityLowHigh
Development speedUsually slowerUsually faster
Hardware controlVery highMore limited
Error correctionMore difficultEasier
PortabilityUsually hardware-dependentOften more portable
ExamplesMachine code, assemblyPython, Java, JavaScript
Common usesDrivers, firmware, embedded systemsWebsites, applications, automation, data analysis

Real-World Analogy: Manual and Automatic Transmission

A low-level language can be compared to driving a manual-transmission vehicle. The driver has more direct control over gear changes, but operating the vehicle requires more skill and attention.

A high-level language can be compared to driving an automatic-transmission vehicle. Many low-level operations are handled automatically, making the vehicle easier to operate.

Similarly:

  • Low-level programming gives the programmer more direct control.
  • High-level programming handles many technical details and allows the programmer to focus on solving the main problem.

8. SOURCE CODE AND MACHINE CODE

Source Code

Source code is the human-readable set of instructions written by a programmer using a programming language.

Example:

name = "Ada"
print(name)

This is understandable to a programmer who knows Python.

Machine Code

Machine code is the binary form of instructions that the computer’s processor can execute directly.

A program written in a high-level language must eventually be translated into machine-level operations.

This translation may be performed by:

  • A compiler
  • An interpreter
  • A combination of compilation and interpretation

9. WHAT IS AN INTERPRETER?

An interpreter is a program that reads, translates, and executes program instructions during program execution.

In a simplified beginner-level explanation, an interpreter processes instructions gradually rather than translating the entire source program into a separate machine-code executable before execution.

How an Interpreter Works

The interpreter generally performs the following tasks:

  1. Reads an instruction.
  2. Translates or processes the instruction.
  3. Executes it.
  4. Moves to the next instruction.
  5. Stops when an error prevents further execution or when the program ends.

Real-World Analogy: A Live Language Interpreter

Imagine a speaker delivering a speech in English to an audience that understands only French.

A live interpreter listens to one sentence, translates it into French, and communicates it to the audience. The interpreter then listens to the next sentence and translates it.

This is similar to how an interpreter processes program instructions during execution.

Advantages of an Interpreter

  • Programs can be tested quickly.
  • Errors can often be identified during execution.
  • It is useful for interactive programming.
  • It supports rapid program development.
  • The same source code may work on different systems that have the correct interpreter.

Disadvantages of an Interpreter

  • The interpreter is needed whenever the program is executed.
  • Execution may be slower than directly running fully compiled native machine code.
  • Some errors may only appear when a particular part of the program is executed.
  • Distributing a program may require the correct runtime environment.

Example of an Interpreted Interaction

A Python programmer can open the Python interactive environment and enter:

2 + 3

Python processes the instruction and immediately returns:

5

The programmer can then enter another instruction.

10. WHAT IS A COMPILER?

A compiler is a program that translates source code into another form before the program is executed.

In traditional compiled languages, the compiler translates the entire source program into machine code or an executable file.

Examples of languages commonly associated with compilation include:

  • C
  • C++
  • Rust
  • Go

How a Compiler Works

A simplified compilation process may involve:

  1. Reading the complete source code.
  2. Checking the code for errors.
  3. Translating the code into machine code or another lower-level form.
  4. Producing an executable program.
  5. Allowing the user to run the executable.

Real-World Analogy: Translating an Entire Book

Suppose an English book needs to be provided to French-speaking readers.

Instead of translating one sentence while each reader is reading, a translator first translates the complete book into French.

Once the translation has been completed, many readers can read the French version without requiring the translator to repeat the work each time.

This is similar to compilation. The complete program is translated before execution.

Advantages of a Compiler

  • The compiled program may execute quickly.
  • The source program does not need to be translated again during every execution.
  • Many errors can be identified before the program runs.
  • The executable may run without the source code being present.
  • Compilers can perform performance optimizations.

Disadvantages of a Compiler

  • Compilation may take time.
  • The program must often be recompiled after changes.
  • A compiled program may be specific to a particular operating system or processor.
  • Testing small changes may involve another compilation step.
  • Compiler error messages can sometimes be difficult for beginners to understand.

11. DIFFERENCE BETWEEN AN INTERPRETER AND A COMPILER

FeatureInterpreterCompiler
Main operationProcesses instructions during executionTranslates the program before execution
Translation approachOften gradual or runtime-basedUsually processes the complete program
Executable fileMay not produce a separate native executableOften produces an executable or object code
Error discoveryErrors may appear during executionMany errors are reported during compilation
Execution speedMay be slower in some casesCompiled native code is often faster
Development processSuitable for rapid testingRequires compilation after changes
Runtime requirementInterpreter or runtime is usually requiredNative executable may run independently
Examples commonly associatedPython, JavaScript, RubyC, C++, Rust, Go

Important Clarification

The distinction between interpreted and compiled languages is not always absolute.

A programming language itself is not permanently limited to one translation method. Different implementations may compile, interpret, or combine both approaches.

For example:

  • Java source code is compiled into bytecode and executed by the Java Virtual Machine.
  • JavaScript engines may interpret code and also compile frequently used sections while the program is running.
  • Python implementations commonly convert source code into bytecode before executing it through a virtual machine.

Therefore, the terms “compiled language” and “interpreted language” are useful introductory descriptions, but real-world language implementations may use several techniques.

12. PYTHON AS AN INTERPRETED LANGUAGE

Python is commonly described as a high-level, general-purpose, interpreted programming language.

This means:

  • Python is designed to be easy for humans to read.
  • Python can be used for many different types of applications.
  • Python programs are normally executed through a Python interpreter.

A Python program may be saved in a file ending with:

.py

For example:

welcome.py

The file may contain:

print("Welcome to Python")

When the program is executed, the Python implementation processes the code and produces:

Welcome to Python

What Happens in Standard Python Execution?

In CPython, which is the most commonly used Python implementation, Python source code is normally converted into an intermediate form called bytecode.

The bytecode is then executed by the Python Virtual Machine.

The simplified process is:

Python Source Code
        ↓
Python Bytecode
        ↓
Python Virtual Machine
        ↓
Program Output

Therefore, saying that Python is interpreted is correct for beginner learning, but the complete process includes an internal compilation step to bytecode.

Benefits of Python’s Execution Model

Python allows beginners to:

  • Run programs quickly
  • Test one instruction at a time
  • Receive immediate feedback
  • Correct errors without complex compilation procedures
  • Use Python on different operating systems

Example

name = input("Enter your name: ")
print("Welcome,", name)

When the program runs:

  1. Python asks the user to enter a name.
  2. The entered name is stored.
  3. Python displays a welcome message.

13. ALGORITHMS AND PROGRAMS

What Is an Algorithm?

An algorithm is a finite, ordered, and unambiguous sequence of steps used to solve a problem or complete a task.

An algorithm describes the logic of a solution before it is written in a programming language.

Algorithms are not limited to computers. People follow algorithms during everyday activities.

Examples include:

  • Preparing a meal
  • Withdrawing money from an ATM
  • Registering for a course
  • Calculating an average score
  • Resetting a password
  • Searching for a name in a list

Real-World Analogy: Directions to a Destination

Directions from one location to another form an algorithm.

For example:

  1. Leave the school gate.
  2. Turn left.
  3. Walk for 300 meters.
  4. Cross the road.
  5. Enter the second building.

The instructions are:

  • Ordered
  • Clear
  • Finite
  • Directed toward a goal

These are also important properties of an algorithm.

13.1 Characteristics of a Good Algorithm

A good algorithm should have the following characteristics:

1. Input

The algorithm may receive one or more values.

Example:

Two examination scores

2. Output

The algorithm should produce a result.

Example:

The average examination score

3. Definiteness

Every step should be clear and unambiguous.

Poor instruction:

Add a suitable amount.

Better instruction:

Add 20 to the total.

4. Finiteness

The algorithm must eventually stop.

An algorithm that continues forever without a valid reason is not suitable for solving a finite problem.

5. Effectiveness

Each step should be possible to perform.

6. Correctness

The algorithm should produce the expected result for valid input.

7. Order

The steps should be arranged in the correct sequence.

13.2 Example Algorithm One: Calculate the Sum of Two Numbers

Problem

Calculate the sum of two numbers.

Algorithm

  1. Start.
  2. Ask the user to enter the first number.
  3. Store the first number.
  4. Ask the user to enter the second number.
  5. Store the second number.
  6. Add the first number and the second number.
  7. Store the result.
  8. Display the result.
  9. Stop.

Input

  • First number
  • Second number

Processing

Result = First number + Second number

Output

  • The sum

Program Representation

first_number = 10
second_number = 5
result = first_number + second_number

print(result)

Output:

15

13.3 Example Algorithm Two: Determine Whether a Student Passed

Problem

Determine whether a student passed or failed an examination.

Assume that the pass mark is 50.

Algorithm

  1. Start.
  2. Ask the student to enter a score.
  3. Store the score.
  4. Compare the score with 50.
  5. If the score is 50 or greater, display “Pass.”
  6. Otherwise, display “Fail.”
  7. Stop.

Input

  • Student’s score

Processing

  • Compare the score with the pass mark.

Output

  • Pass or fail

Program Representation

score = 65

if score >= 50:
    print("Pass")
else:
    print("Fail")

Output:

Pass

14. DIFFERENCE BETWEEN AN ALGORITHM AND A PROGRAM

An algorithm and a program are related, but they are not exactly the same.

AlgorithmProgram
A logical sequence of stepsA coded implementation of the steps
Can be written in ordinary languageWritten in a programming language
Focuses on solving the problemFocuses on instructing the computer
Independent of a particular languageUsually written in a specific language
May be represented using pseudocode or a flowchartRepresented using source code
Cannot normally be executed directly by a computerCan be translated and executed

Real-World Analogy: Building Plan and Completed Building

An algorithm can be compared to a building plan.

The building plan shows:

  • The number of rooms
  • The position of doors
  • The structure of the building
  • The construction sequence

The program is similar to the completed building created from the plan.

A clear plan makes construction easier. Similarly, a clear algorithm makes program development easier.

15. METHODS OF REPRESENTING AN ALGORITHM

An algorithm can be represented using:

  1. Natural language
  2. Pseudocode
  3. Flowcharts
  4. Programming code

15.1 Natural Language

Natural language uses normal human sentences.

Example:

  1. Enter two numbers.
  2. Add the numbers.
  3. Display the result.

Natural language is easy to understand, but it may sometimes be unclear or ambiguous.

15.2 Pseudocode

Pseudocode is an informal method of writing the steps of an algorithm using programming-style statements without following the strict rules of a particular programming language.

Example:

START
INPUT first_number
INPUT second_number
result = first_number + second_number
OUTPUT result
STOP

Pseudocode helps programmers focus on the logic before writing actual code.

15.3 Flowchart

A flowchart is a graphical representation of an algorithm using standard shapes and arrows.

Common flowchart symbols include:

SymbolMeaning
OvalStart or stop
RectangleProcessing operation
ParallelogramInput or output
DiamondDecision
ArrowDirection of flow

Flowcharts help programmers visualize the order in which operations will occur.

16. INPUT, PROCESSING, AND OUTPUT

Most computer programs perform three major activities:

  1. Input
  2. Processing
  3. Output

This is commonly called the IPO model.

Input

Input is the data supplied to a computer program.

Examples include:

  • A name entered with a keyboard
  • A photograph captured by a camera
  • A PIN entered into an ATM
  • A voice command
  • A product barcode
  • A student’s examination score

Processing

Processing refers to the operations performed on the input.

Examples include:

  • Adding numbers
  • Comparing a password
  • Sorting names
  • Calculating a grade
  • Searching for a record
  • Converting a currency
  • Recognizing a face

Output

Output is the result produced by the program.

Examples include:

  • A calculated total
  • A displayed message
  • A printed receipt
  • An email notification
  • A grade report
  • An audio response

Example: School Result System

Input

  • Student name
  • Subject scores

Processing

  • Add the scores
  • Calculate the average
  • Determine the grade

Output

  • Total score
  • Average score
  • Grade
  • Remark

Real-World Analogy: A Fruit Blender

A blender provides a simple example of input, processing, and output.

  • Fruits, water, and sugar are the input.
  • Blending is the processing.
  • Fruit juice is the output.

A computer program operates similarly. It receives data, performs operations, and produces results.

17. COMMON APPLICATIONS OF PROGRAMMING

Programming is applied in almost every modern industry.

17.1 Web Development

Programming is used to create websites and web applications.

Examples include:

  • Search engines
  • Online stores
  • School portals
  • Scholarship websites
  • Social media platforms
  • Online banking systems

Web development may involve languages such as:

  • HTML
  • CSS
  • JavaScript
  • Python
  • PHP
  • Java

17.2 Mobile Application Development

Programming is used to create applications for smartphones and tablets.

Examples include:

  • Messaging applications
  • Banking applications
  • Navigation applications
  • Mobile games
  • Educational applications
  • Health-monitoring applications

17.3 Desktop Application Development

Desktop applications run on personal computers.

Examples include:

  • Word processors
  • Media players
  • Accounting software
  • Graphic-design software
  • School management systems

17.4 Data Analysis

Programming can be used to collect, clean, analyze, and visualize data.

Examples include:

  • Analyzing sales records
  • Studying student performance
  • Predicting customer behavior
  • Identifying business trends
  • Creating reports and dashboards

Python is widely used in data analysis.

17.5 Artificial Intelligence and Machine Learning

Programming is used to develop systems that perform tasks associated with human intelligence.

Examples include:

  • Facial recognition
  • Voice assistants
  • Fraud detection
  • Recommendation systems
  • Medical diagnosis support
  • Chatbots
  • Self-driving vehicle systems

17.6 Automation

Programming can automate repetitive tasks.

Examples include:

  • Renaming hundreds of files
  • Sending scheduled emails
  • Creating reports
  • Copying data between documents
  • Processing invoices
  • Backing up files
  • Extracting information from websites

Example

An employee may spend two hours every day copying sales figures from several files into one report.

A Python program may be created to perform the same task automatically in a few minutes.

17.7 Banking and Financial Technology

Programming is used in:

  • ATM systems
  • Mobile banking
  • Online transfers
  • Payment gateways
  • Fraud detection
  • Loan-processing systems
  • Account management systems
  • Financial trading platforms

17.8 Healthcare

Programming supports:

  • Electronic health records
  • Patient appointment systems
  • Medical imaging
  • Laboratory systems
  • Health-monitoring devices
  • Disease-prediction models
  • Hospital management systems

17.9 Education

Programming is used in:

  • Computer-based examinations
  • Online learning platforms
  • School portals
  • Attendance systems
  • Result-processing systems
  • Educational games
  • Virtual classrooms

17.10 Transportation

Programming controls or supports:

  • Traffic lights
  • Navigation systems
  • Airline reservation systems
  • Ride-hailing applications
  • Vehicle-tracking systems
  • Logistics systems
  • Railway scheduling systems

17.11 Communication

Programming is responsible for:

  • Email systems
  • Video-conferencing tools
  • Messaging platforms
  • Social media applications
  • Voice-over-Internet systems
  • Mobile-network services

17.12 Entertainment and Gaming

Programming is used to create:

  • Video games
  • Music applications
  • Streaming platforms
  • Animation software
  • Movie effects
  • Virtual reality systems

17.13 Cybersecurity

Programming is used to:

  • Detect suspicious activity
  • Encrypt information
  • Test systems for weaknesses
  • Monitor networks
  • Block unauthorized access
  • Analyze malicious software
  • Automate security checks

17.14 Scientific Research

Scientists use programming to:

  • Simulate natural processes
  • Analyze experimental data
  • Model weather conditions
  • Study space
  • Analyze genetic data
  • Perform mathematical calculations

17.15 Robotics and Embedded Systems

Programming is used to control:

  • Industrial robots
  • Drones
  • Smart appliances
  • Security systems
  • Traffic-control devices
  • Automated manufacturing equipment
  • Medical devices

18. THE BASIC PROGRAM DEVELOPMENT PROCESS

Developing a computer program normally involves several stages.

Stage One: Define the Problem

The programmer must clearly understand the problem.

Example:

The school needs a program that calculates students' average scores.

Stage Two: Analyze the Requirements

The programmer identifies:

  • Required input
  • Required processing
  • Expected output
  • Users of the system
  • Rules that the program must follow

Stage Three: Design the Solution

The programmer develops:

  • Algorithms
  • Pseudocode
  • Flowcharts
  • Data structures
  • Program components

Stage Four: Write the Code

The solution is converted into a programming language.

Stage Five: Test the Program

The program is tested using different inputs.

Questions include:

  • Does the program produce the correct output?
  • What happens when the user enters invalid data?
  • Does the program work under different conditions?

Stage Six: Debug the Program

Errors are identified and corrected.

Stage Seven: Document the Program

Documentation explains:

  • What the program does
  • How to use it
  • How its components work
  • How it can be maintained

Stage Eight: Deploy the Program

The program is made available to its users.

Stage Nine: Maintain the Program

The program may be updated to:

  • Correct newly discovered errors
  • Improve security
  • Add features
  • Support new requirements
  • Improve performance

19. PROGRAMMING ERRORS AND DEBUGGING

A program may fail to work correctly because of errors.

An error in a program is commonly called a bug.

The process of finding and correcting errors is called debugging.

19.1 Syntax Errors

A syntax error occurs when the rules of the programming language are violated.

Example:

print("Hello"

The closing parenthesis is missing.

19.2 Runtime Errors

A runtime error occurs while the program is executing.

Example:

result = 10 / 0

Division by zero is not allowed, so the program produces an error.

19.3 Logical Errors

A logical error occurs when the program runs but produces the wrong result.

Example:

length = 10
width = 5
area = length + width

The program runs and produces 15, but the correct area is 50.

Logical errors can be difficult to detect because the program may not display an error message.

Real-World Analogy: An Incorrect Address

Suppose a delivery driver receives the instruction:

Deliver the package to House 16.

The instruction is clear and can be followed, but the correct address was House 61.

The driver successfully follows the instruction but delivers the package to the wrong place.

This resembles a logical error. The instruction can be executed, but it produces the wrong outcome.

20. HOW COMPUTERS FOLLOW INSTRUCTIONS

Computers are powerful, but they are literal.

A computer:

  • Does not guess the programmer’s intention.
  • Does not automatically correct unclear logic.
  • Follows the instructions provided.
  • Performs operations very quickly.
  • Repeats operations consistently.
  • Can process large amounts of data.

If a programmer provides incorrect instructions, the computer may produce incorrect results.

This idea is sometimes expressed as:

Garbage In, Garbage Out

This means that incorrect input or incorrect instructions are likely to produce incorrect output.

Example

Suppose a program calculates a student’s average using:

Average = Total score ÷ 2

However, the student took five subjects.

The computer will perform the division by two because that is the instruction provided, even though the correct calculation should divide the total by five.


Receive News Updates and Tutorials Through our Social Media Channels, join:

  • WhatsApp: BloginfoHeap WhatsApp
  • Facebook: BloginfoHeap
  • Twitter (X): @BloginfoHeap
  • YouTube: @BloginfoHeap
Post Views: 40

Tags:

algorithm in programmingalgorithms and programsapplications of programmingcoding for beginnerscompiler vs interpretercomputer programming for beginnerscomputer programming tutorialhigh-level programming languagesIntroduction to Computer Programmingintroduction to programminglearn programminglow-level programming languagesprogramming basics for beginnersprogramming fundamentalsprogramming languagesPython fundamentalsPython interpreted languagePython programming for beginnerswhat is a compilerwhat is a computer programwhat is a programmerwhat is an interpreterwhat is computer programmingwhat is programming
Author

BloginfoHeap

Follow Me
Other Articles
Python built-in data types
Previous

Python Built-in Data Types Explained

NVIDIA acquires Hugging Face
Next

NVIDIA Acquires Hugging Face for $12.9B – A Historic Shift in the AI Ecosystem

One Comment
  1. Fred says:
    September 8, 2026 at 6:11 pm

    Now I understand better about computer programming. Thanks for sharing with us! Keep bringing more valuable contents like this

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You May Also Like

Meta Muse
AI Tech Daily

Meta Just Launched Muse: The Personal AI Agent That Works 24/7 to Run Your Digital Life

BloginfoHeap
By BloginfoHeap
September 11, 2026
AI could end humanity by 2030 - Featured
AI Tech Daily

Researcher Quits Anthropic, Warns AI Could End Humanity by 2030

BloginfoHeap
By BloginfoHeap
September 10, 2026
NVIDIA acquires Hugging Face
AI Tech Daily

NVIDIA Acquires Hugging Face for $12.9B – A Historic Shift in the AI Ecosystem

BloginfoHeap
By BloginfoHeap
September 9, 2026
Introduction to computer programming
Python Tech Daily Training

Python Fundamentals for Beginners: Introduction to Computer Programming

BloginfoHeap
By BloginfoHeap
September 8, 2026
Logo
  • All Post
  • Contact us
  • Who We Are

Top Categories

  • Python
  • Training
  • How tos

Policy

  • Disclaimer
  • Terms of use
  • Privacy Policy
© 2026 • Bloginfoheap • All Right Reserved