Programming Technics
Programming Technics
ALGORITHMS
RECOMMENDATIONS FOR EFFECTIVE LEARNING
• Come to class
• Punctuality
• Proactive participation in class
• Do not be a perfectionist,allow mistakes to happen and
learn from them, try and experiment, ask questions.
• Study and work at home.
PROGRAMMING TECHNICS
• Introduction:Programming • ControlStructures:
languages - IDE – Thonny – Sequence, Conditional,
VSC (Visual Studio Code) Iteration
• Algorithms:Data types, • Arrays
variables and constants • Matrices (Image Bitmaps)
• Flow Diagrams • Functions
• Input/Output
INTRODUCTION
• Computer:
• electronic device to process information and extract results. Data or
information can be entered into the computer device as INPUT where it
is subsequently processed to produce an OUTPUT result.
INPUT PROCESS OUTPUT
• Program:
• A set of instructions written in a given programming language that when
executed in the order as written (sequence), solves a specific problem.
INTRODUCTION
• Programming Language:
• Language adapted to communicate orders to a computer, it consists
of a set of symbols, characters, syntax and semantic rules with
which users communicate with the computer device to obtain in
return comprehensible answers.
• Programming languages have a set of instructions that allow the
user to perform certain operations:
• INPUT/OUTPUT
• Calculation (arithmetic) / String manipulation (text strings)
• Logic / Comparisons
• Storage / Recall (Recovery)
INTRODUCTION
Yes
End
ALGORITHMS
• We have two variables that will change: the pitcher and the glass
• The glass has a fixed volume and is empty, then it will be filled, it does not matter how
much as long as it does not exceed the volume of the glass.
• The pitcher is a bit different, it holds an initial quantity of water and it has a second
‘variable’ a given placement (inside the fridge, could be at the door, at the back or up
front of an inner shelf).
• We can identify an operation that involves two variables: serving the pitcher content into
the empty glass, changing the values of both variables. The glass value will increase
while the pitcher value will decrease in equal amount (linear relationship).
• There is one final operation that has two stages, meaning that one implies the other.
Opening the fridge to access the pitcher and once the pitcher is placed back in the
initial place closing it.
ALGORITHMS
Data
• Any data value comes associated to a data type. Data can be a simple character
such as the letter “b” or an integer number such as 35.
= 3.14159 = ‘John’
Pi name
ALGORITHM
SEQUENTIAL STRUCTURES
• Start
• A sequential process is the • Action 1
shape a process adopts if
each action or step
• Action 2
(instruction) follows a • ……………………
defined order.
• The output of a step is the
• Action N
input of the following step • End
until the end is reached.
• A sequence may be
represented as follows:
ALGORITHMS
Process
Decision
Input/Output
Data
Start/End
ALGORITHMS:
AREA = (Pi*(radius**2))
START START
• Pi 3.14159 • Pi 3.14159
• INPUT radius • INPUT radius
• Aux (radius * radius) • Area (Pi * (radius^2))
• Area (Pi * Aux) • OUTPUT Area
• OUTPUT Area END
END
Both versions are correct.
START
ALGORITHMS
Pi 3.14159
Final Flow Diagram:
START
INPUT radius
• Pi 3.14159
• INPUT radius
Area (Pi*(radius^2))
• Area (Pi * (radius^2))
• OUTPUT Area
OUTPUT Area
END
END
ALGORITHMS
Exercises: