ICS104: INTRODUCTION TO PROGRAMMING
IN PYTHON AND C
LECTURE 1: OVERVIEW OF COMPUTERS & PROGRAMMING
Dr. Hamzah Luqman
Office: Building 22 room 107
Email: hluqman@[Link]
COURSE OBJECTIVES
Provide engineering students with basic knowledge of
programming in Python and C and problem solving.
LECTURE 1: OVERVIEW OF COMPUTERS
& PROGRAMMING
COMPUTERS
❖ A computer is a machine that can be
programmed to receive data as
inputs, process them into useful
information (output), and store the
results into a secondary
storage device for safe keeping or
later reuse.
❖ Computer can deal with numbers,
text, images, graphics, and sound.
6
COMPUTERS
Item Quantity Price
Medium Sodas 2 $1.49
Small Turkey sub 1 $3.49
Caesar Salad 1 $4.49
Bag of chips 1 $0.99
Cookies 3 $0.39
Amount Received $20.00
5
COMPUTER COMPONENTS
6
SMART PHONES
Hardware Software
7
COMPUTER COMPONENTS
Programs
Software
Application Software developed to assist
a computer user in accomplishing Operating system
specific tasks.
Example: Word, Excel, Chrome.
Input and Output Unit
Hardware
Memory
Central Processing Unit
(CPU)
Storage
8
COMPUTER COMPONENTS…
Operating System controls the Programs
Software
interaction between machine and user.
Example, Windows, Linux, ios...etc Operating system
Input and Output Unit
Hardware
Memory
Central Processing Unit
(CPU)
➢ Communicate with computer user.
Storage
➢ Manage memory.
➢ Collect input/Display output.
➢ Read/Write data
9
COMPUTER HARDWARE
10
THE ANATOMY OF A COMPUTER
The Computer Hardware consists of the physical elements in
a computer system.
The central processing unit (CPU) performs program
control and data processing
Storage devices include
Primary memory: Consists of memory chips (electronic circuits that
can store data as long as it is provided electric power).
Fast and more expensive.
e.g., RAM and ROM
Secondary storage: Provides slower, less expensive storage that is
persistent (without electric power)
e.g., Hard disks, flash drives, CD/DVD drives.
Computers store both data and programs
Both are located in secondary storage and are loaded into primary storage
when programs are executed.
Input/output devices allow the user to interact with the
computer
Mouse, keyboard, printer, screen
11
THE CENTRAL PROCESSING UNIT
(CPU)
The CPU has two components, the control unit and
the arithmetic logic unit
The control unit directs operation of the processor.
Computer resources are managed by the control unit.
Controls communication and co-ordination between
input/output devices.
Reads and interprets instructions and determines the
sequence for processing the data.
Provides timing and control signals
The arithmetic logic unit contains the circuitry to
perform calculations and do comparisons.
It is the workhorse portion of the computer and its job is 12
to do precisely what the control unit tells it to do.
MEMORY
• Computer memory is a physical device capable of
storing information temporarily.
Programs
Software
• For example, Random Access Memory (RAM)
Operating system
Input and Output Unit
Hardware
Memory
Central Processing Unit
(CPU)
Storage
COMPUTER LANGUAGES
Programming Languages allow us to write programs that tell the computer
what to do and thus provide a way to communicate with computers.
Programs are then converted to machine language (0 and 1) so the computer
can understand it.
14
COMPUTER LANGUAGES
Machine Language – A collection of binary numbers
Not standardized. There is a different machine
language for every processor family.
Example of adding two numbers:
Assembly Language - mnemonic codes that
corresponds to machine language instructions.
Low level: Very close to the actual machine
language.
Example of adding 70 (stored in address 55 in
memory) and 30 (stored in address 55 in memory).
High-level Languages - Combine algebraic expressions
and symbols from English
High Level : Very far away from the actual
machine language
For example: Python, Cobol, C, Prolog, Pascal, C#,
Perl, Java.
15
Example of adding 45 and 55 in C language
X = 70 + 30;
FLOW OF INFORMATION DURING
PROGRAM EXECUTION
Program instructions and data (such as text,
numbers, audio, or video) are stored on the hard
disk, on a compact disk (or DVD), or elsewhere on
the network.
When a program starts, it is brought into
memory, where the CPU can read it.
one instruction at a time.
The CPU reads, modifies and writes data back to
memory or the hard disk.
16
FLOW OF INFORMATION DURING
PROGRAM EXECUTION
17