You are on page 1of 22

Unit 3

Programming
Overview

• In this unit , we will learn the fundamentals of


computer programming using python and it
will focus on programming syntax , variables,
data types and etc.
• In this unit we will develop skills to write ,
compile and execute programs to solve
problems.
Unit objectives

• At the end of this unit , the learner should be


able to :
• Discuss the basic of programming.
• Identify the different types of programming
languages.
• Demonstrate the ability to solve problems
using python.
Lesson 1: Basic programming

• Learning objectives
• At the end of the lesson , the learner should able to :
• Define programming
• Identify the types of programming languages ( high-
level languages and low-level languages).
• Define what is debugging
• List and identify the most popular programming
languages
Overview

• Computers are wonderful machines , unlike most


machines , the computers are purposeless machines
that can be taught to accomplish anything , think
about some of different ways that people use
computers at school, work, and home.
• You realize the uses of computers are almost
limitless in our everyday lives.
• The power to enable a computer to almost
everything is called programming.
Cont.
• Computers can do a wide variety of things
because they can be programmed.

• This means that the computers are not only


designed to accomplish just one job , but to
do any job that their programs tell them to do.
1.1 what is programming

• As you have already learned , the software rules the hardware


(physical machine) and it determines what any computer can
do.

• Without software, computers would just be expensive


paperweights.

• The process of creating software is called programming.

• A program is a step by step set of instructions telling a


computer exactly what to do.
Programming languages

• Note : that a program is just a sequence of


instructions telling a computer what to do.
• it must provide those instructions in a language
that a computer can understand.
• It would be fine if you could just tell a computer
what to do using your native language.
• But developing a computer to fully understand the
natural languages is still an unsolved problem.
Cont.
• Even if we suppose that computers can
understand you , human languages are not very
well suitable for describing complex algorithms.
• Computer scientists developed natation’s for
expressing computations in an exact and
unambiguous way.
• These special notations are called
programming languages.
Cont.
• A programming language is code for writing down to
tell the computer the instructions it will follow.
• Coding is using a set of instructions to communicate
with computers.
• Coding make it possible for us to create computer
software.
• Coders or programmers are people who write the
programs behind everything we see and do on a
computer.
Cont.
• Languages are defined as human-readable
( high-level languages ) or machine-readable
( low-level languages).

• In high-level languages , the instructions are


encoded in a languages that humans can use and
understand , while in low-level languages, the
instructions are in a language that computers
understand and are in binary code.
Cont.
• Computers only have the ability to run
programs written in low-level languages.

• Thus , programs written in a high-level


language have to be processed before they are
executed.
Cont.
• Furthermore , high-level languages are
portable , meaning that they can be run on
different types of operating systems with few
or no modifications.
• Low-level programs can only run on one kind
of machine and it requires to be rewritten to
execute on another machine.
Cont.
• Almost all programs are written in high-level
language, while low-level languages are used
only for a few specific applications.

• High-level language is easier for us to


understand , but we need some way to
translate it into the machine language that the
computer can execute.
Interpreter and compiler
• Two types of programs are used to process
high-level languages into low-level languages :

• An interpreters; this translates the code into


machine code, instruction by instruction, the
machine executes each instruction before the
interpreter moves on the text instruction.
Cont.
• A compiler; this translates the entire program
into machine code before the program is
executed.

• It can be difficult to test single lines of


compiled code compared to interpreted
languages as all bugs are reported after the
entire program has been compiled.
IDE

• An integrated development environment (IDE) is


an application is used to create programs .

• and IDE can often support different languages.

• IDEs have a number of different tools and


functions that assist a developer in creation of
programs, the common tools of IDEs are :
1. Code editor
• Code editor : the code editor is a text edit area
that allows developers to write , edit and save
a document of code.

• It has features that assist with the writing and


editing of code such as auto-completion and
syntax checking.
2. translator

• Translator : this translates the high-level


language into the machine language by
compiling or interpreting.
3. Debugger

• Debugger : this is a program within the IDE


that is used to detect errors.

• If the program has errors, the debugger may


suggest what the type of error is and what line
it is on.
The difference between High level and low-
level language
1 ) High level language
• Easy programmers to understand
• High level language contains English words

2) Low-level language
• The computers own language
• Binary numbers all 1s and 0s
Th
an
ky
ou
for
you
ra
tte
nti
o n

You might also like