[go: up one dir, main page]

0% found this document useful (0 votes)
4 views23 pages

01-Intro

The document provides an introduction to computer programming, defining it as the process of creating executable instructions for computers using various programming languages. It contrasts high-level languages, like Python, which are user-friendly and portable, with low-level languages that are more complex and machine-specific. Additionally, it explains the roles of interpreters and compilers in translating high-level code into machine language for execution by the CPU.

Uploaded by

Abdullah Emam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views23 pages

01-Intro

The document provides an introduction to computer programming, defining it as the process of creating executable instructions for computers using various programming languages. It contrasts high-level languages, like Python, which are user-friendly and portable, with low-level languages that are more complex and machine-specific. Additionally, it explains the roles of interpreters and compilers in translating high-level code into machine language for execution by the CPU.

Uploaded by

Abdullah Emam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Python

Introduction - Part 1
Why Program?
Section #1

Eng :Abdullah Emam


Software Engineering
Programming..
Computer programming is about instructing computers on what they should do next. There are several programming languages such as C, C++, Java,
, JavaScript, Python.

Computer Programming - Definition


Programming refers to the process of designing and building an executable set of instructions to accomplish a specific task on a
computer to get the desired result. It includes various tasks such as analysis, generating algorithms, determining their accuracy,
and the implementation of algorithms in a chosen programming language. Testing, debugging, source code maintenance, and
implementation of build systems are also a part of the programming process.
Types of programming languages
•Low level Languages

•High level Languages


High level languages Vs. Low level
Low level languages
•Machine language

•It consists of 0-1

•It is easy to be executed

•It is hard to program

•Can run only of one kind of computer and it have to be


rewritten again to another PC
High level languages
•Easy to program

•Flexible syntax and easy to read

•Large community

•These are Interpreted

•Takes less time to be coded but poor performance to Computer

•Easy to be corrected

•Portable >>> such as any app or program

•Like Python, Java…


Terminology: Interpreter and compiler
•Python is a high-level language intended to be relatively
straightforward for humans to read and write and for computers to
read and process. Other high-level languages include Java, C++,
PHP, Ruby, Basic, Perl, JavaScript, and many more. The actual
hardware inside the Central Processing Unit (CPU) does not
understand any of these high-level languages.

•The CPU understands a language we call machine language.


Machine language is very simple and frankly very tiresome to write
because it is represented all in zeros and ones:
Machine language seems quite simple on the surface, given that there
are only zeros and ones, but its syntax is even more complex and far
more intricate than Python. So very few programmers ever write
machine language. Instead we build various translators to allow
programmers to write in high-level languages like Python or
JavaScript and these translators convert the programs to machine
language for actual execution by the CPU.
These programming language translators fall into two general
categories: (1) interpreters and (2) compilers.
interpreters
•An interpreter translate the source program line by line

•Slower execution

•Display all Errors of each line one by one so, if interpreter


ffound one error it will stop immediately working raising this
error

•No intermediate code, thus less memory required

•An interpreter is used by programming languages such as


Python, PHP, Ruby, ect..
compiler
•A compiler translate the compiler source program in a single
line

•Faster execution

•Display All Errors after, Compilation, all at the same time.

•Intermediate object code requires memory.

•The compiler is best used by programming languages such


as C, C++, C#, Java etc..
Computers Want to be Helpful...
What
• Computers are built for one purpose - to Next?
do things for us

• But we need to speak their language to


describe what we want done

• Users have it easy - someone already put What What What


many different programs (instructions) into Next? Next? Next?
the computer and users just pick the ones
they want to use What What What
Next? Next? Next?
Programmers Anticipate
Needs
• iPhone applications are a market

• iPhone applications have over 3 billion


downloads

• Programmers have left their jobs to be


full-time iPhone developers Pick Pick Pick
Me! Me! Me!
• Programmers know the ways of the
program Pick Pick Pay
Me! Me! Me!
User

Computer
Programmer
Hardware + Software

Data Information .... Networks

From a software creator’s point of view, we build the software. The end
users (stakeholders/actors) are our masters - who we want to please -
often they pay us money when they are pleased. But the data,
information, and networks are our problem to solve on their behalf.
The hardware and software are our friends and allies in this quest.
What is Code? Software? A Program?

• A sequence of stored instructions

- It is a little piece of our intelligence in the computer

- We figure something out and then we encode it and then give it to


someone else to save them the time and energy of figuring it out

• A piece of creative art - particularly when we do a good job on user


experience
name = input('Enter file:')
handle = open(name)

counts = dict()
python words.py
for line in handle: Enter file: words.txt
words = line.split() to 16
for word in words:
counts[word] = counts.get(word,0) + 1

bigcount = None
bigword = None
for word,count in counts.items(): python words.py
if bigcount is None or count > bigcount: Enter file: clown.txt
bigword = word the 7
bigcount = count

print(bigword, bigcount)
Hardware Architecture
Generic
Software What
Next? Computer
Input Central
and Output Processing
Devices Unit
Secondary
Memory

Main
Memory
Definitions
• Central Processing Unit: Runs the Program - The CPU is What
always wondering “what to do next”. Not the brains Next?
exactly - very dumb but very very fast

• Input Devices: Keyboard, Mouse, Touch Screen

• Output Devices: Screen, Speakers, Printer, DVD Burner

• Main Memory: Fast small temporary storage - lost on reboot - aka RAM

• Secondary Memory: Slower large permanent storage - lasts until deleted - disk
drive / memory stick
Generic
Software What
Next? Computer
Input Central
and Output Processing
Devices Unit
Secondary
if x< 3: print Memory

Main
Memory
Generic
Software What
Next? Computer
Input Central
and Output Processing
Devices Unit
01001001 Secondary
00111001 Memory

Main
Memory
Machine
Language
Acknowledgements / Contributions

You might also like