0% found this document useful (0 votes)
13 views

Algorithms

This document provides an overview of algorithms, variables, inputs, pseudocode, and flowcharts in programming. It explains the purpose of variables for storing data, the use of input() for gathering user input, and the importance of pseudocode for planning algorithms. Additionally, it discusses real-life applications of algorithms and introduces data types and the concept of sequence in algorithm execution.

Uploaded by

Janika Frimpong
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Algorithms

This document provides an overview of algorithms, variables, inputs, pseudocode, and flowcharts in programming. It explains the purpose of variables for storing data, the use of input() for gathering user input, and the importance of pseudocode for planning algorithms. Additionally, it discusses real-life applications of algorithms and introduces data types and the concept of sequence in algorithm execution.

Uploaded by

Janika Frimpong
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Algorithms

Lesson Objectives
What is
Variables?
• A variable is a container used to store data in a
program. It allows us to save values and use them later.

Example Here, name stores "Alice" and


age stores 14.
Inputs
• In Python, this is done using input().The input is stored in a
variable for later use.
• Example: To add two numbers, we request and store them
before calculating the sum.
The Input
Script
The input() script is set up like
this
Pseudocode – Writing an Algorithm
Without Code
• Pseudocode is a simplified way of
writing code.
Why Use Pseudocode?
Helps plan before writing real code.
Doesn't follow specific programming language syntax.

Why is pseudocode useful for


planning programs?
What is an Algorithm?
Real-Life Applications:
• An algorithm is a step-by-step • Google Maps uses
set of instructions to solve a algorithms to find the
problem shortest route.
Example:
1.Making a cup of tea • Netflix recommends
shows using an algorithm
2.Boil water
3.Put a tea bag in a cup
Discuss with the person
4.Pour hot water into the cup
next to you and Can you
5.Remove the tea bag think of an algorithm you
6.Add sugar/milk if needed follow in daily life?
7.Stir and drink
Flowcharts – Visualizing Algorithms
• A flowchart is a diagram that represents an
algorithm using symbols.

Why Use What symbols do we


Flowcharts? use to show decisions
• Makes it easier to visualize logic
before coding.
• Helps debug errors in an algorithm.
in a flowchart?
Example Code
Outputs
• When we wish to output information (strings/numbers)
onto the screen, we use the print() statement.
Data Types

Data Type Description


String Combination of different keyboard
characters- Bitesize
Integer Whole number- 17
Real / Float Decimal number - 17.65
Boolean True / False
Character Single keyboard character - $
Sequence
• The specific order in which instructions are performed in
an algorithm
Selection

You might also like