Programming Basics and Data Analytics
with Python
Introduction to Programming
Learning Objectives
By the end of this lesson, you will be able to:
Explain what is program and programming language
List the types of programming languages
Describe an algorithm, pseudocode, and a flowchart
Differentiate between a compiler and an interpreter
Program
What Is a Program?
A program is a set of instructions a computer follows in order to perform a task.
Programming Language
What Is a Programming Language?
• It is a set of rules that instructs a computer on what operations to perform.
• It is a set of rules for communicating an algorithm.
Problem Solution
Types of Programming Languages
Object-Oriented
Programming Language
Scripting Programming
Functional Programming
Language
Language
Logical
Procedural Programming
Programming Language
Language
Requirements for Programming Languages
Must be simple Should have good
and easy to learn readability
Should be well-
structured and
documented
Algorithm, Pseudocode, and Flowchart
Algorithm
An algorithm is a detailed step-by-step method to solve a problem.
Input Algorithm Output
Pseudocode
Pseudocode is a way of writing a program description that includes simple descriptions but does
not have precise syntax.
Example:
A pseudocode to find the total of two numbers is as follows.
Sum of two numbers:
Begin
Set sum = 0;
Read: number 1, number 2;
sum = number 1 + number 2;
Print sum;
End
Flowchart
A flowchart represents an algorithm using a diagram.
Flowcharts are commonly used in programming to represent the steps in a program.
Start
Input
Process
Output
End
Pseudocode vs. Flowchart
Pseudocode Flowchart
An informal high-level description of the A diagrammatic representation that
operating principle of an algorithm illustrates a solution model to a given
problem
Written in natural language and Written using various symbols
mathematical notations
Compiler and Interpreter
Compiler and Interpreter
A compiler is a special program that processes statements written in a programming language and
converts them into machine language.
first.c Machine First
Code
Compiler
#include<stdio.h RESULT
Void main() 11100000
printf(“First”) 110000
Getch()
11110000
An interpreter is a program that reads and executes each instruction of the code. This includes source
code, precompiled code, and scripts.
first.p
y
Interpreter
print(“First”)
RESULT
Compiler vs. Interpreter
Compiler Interpreter
Compiler takes an entire program as input. Interpreter takes a single instruction as
input.
Intermediate object code is generated. No intermediate object code is generated.
Memory requirement is more since object Memory requirement is less.
code is generated.
Program need not to be compiled every Higher level program is converted to lower
time. level program each time.
Errors are displayed after the entire program Errors are displayed for every instruction
is checked. interpreted.
Program execution is fast. Program execution is slow.
Examples: C, C++ Examples: Visual basic, Python
Knowledge Check
Knowledge
Check
Which of the following is a detailed step-by-step method for solving a problem?
1
a. Pseudocode
b. Compiler
c. Algorithm
d. Flowchart
Knowledge
Check
Which of the following is a detailed step-by-step method for solving a problem?
1
a. Pseudocode
b. Compiler
c. Algorithm
d. Flowchart
The correct answer is c
An algorithm is a detailed step-by-step method for solving a problem.
Knowledge
Check
Which of the following represents an algorithm using a diagram?
2
a. Pseudocode
b. Compiler
c. Interpreter
d. Flowchart
Knowledge
Check
Which of the following represents an algorithm using a diagram?
2
a. Pseudocode
b. Compiler
c. Interpreter
d. Flowchart
The correct answer is d
A flowchart represents an algorithm using a diagram.
Knowledge
Check
Which of the following options takes a single instruction as input?
3
a. Algorithm
b. Interpreter
c. Compiler
d. Pseudocode
Knowledge
Check
Which of the following options takes a single instruction as input?
3
a. Algorithm
b. Interpreter
c. Compiler
d. Pseudocode
The correct answer is b
Interpreter takes a single instruction as input.
Key Takeaways
A program is a set of instructions a computer follows to
perform a task.
An algorithm is a detailed step-by-step method for solving a
problem.
A pseudocode is an informal way of writing a program.
A flowchart represents an algorithm using a diagram.
Compiler takes an entire program as input, whereas interpreter
takes a single instruction as input.