Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
95 views

Python Essentials 1

The document discusses the fundamentals of computer programming including how programs work, compilation vs interpretation, and what defines a programming language. It also covers what Python is and how it compares to other languages.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views

Python Essentials 1

The document discusses the fundamentals of computer programming including how programs work, compilation vs interpretation, and what defines a programming language. It also covers what Python is and how it compares to other languages.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Essentials 1:Module 1(Introduction to Python and computer

programming)

1. the fundamentals of computer programming, i.e., how the computer works, how the program
is executed, how the programming language is defined and constructed;
2. The difference between compilation and interpretation
3. what Python is, how it is positioned among other programming languages, and what
distinguishes the different versions of Python.

1-How does a computer program work ?


A program makis a computer usable. Without a program, a computer, even the most
powerful one, is nothing more than an object. Similarly, without a player, a piano is
nothing more than a wooden box.

Imagine that you want to know the average speed you've reached during a long
journey. You know the distance, you know the time, you need the speed.

Naturally, the computer will be able to compute this, but the computer is not aware
of such things as distance, speed, or time. Therefore, it is necessary to instruct the
computer to:

 accept a number representing the distance;


 accept a number representing the travel time;
 divide the former value by the latter and store the result in the memory;
 display the result (representing the average speed) in a readable format.

These four simple actions form a program. Of course, these examples are not
formalized, and they are very far from what the computer can understand, but they are
good enough to be translated into a language the computer can accept.

Language is the keyword.

2-Natural languages vs. programming languages


The commands it recognizes are very simple. We can imagine that the computer
responds to orders like "take that number, divide by another and save the result".

A complete set of known commands is called an instruction list, sometimes abbreviated


to IL. Different types of computers may vary depending on the size of their ILs, and the
instructions could be completely different in different models.

Moreoverr, they are still evolving, and new words are created every day as old
words disappear. These languages are called natural languages.
3-What makes a language?
 an alphabet: a set of symbols used to build words of a certain language (e.g., the Latin
alphabet for English, the Cyrillic alphabet for Russian, Kanji for Japanese, and so on)
 a lexis: (aka a dictionary) a set of words the language offers its users (e.g., the word
"computer" comes from the English language dictionary, while "cmoptrue" doesn't; the
word "chat" is present both in English and French dictionaries, but their meanings are
different)
 a syntax: a set of rules (formal or informal, written or felt intuitively) used to determine if a
certain string of words forms a valid sentence (e.g., "I am a python" is a syntactically
correct phrase, while "I a python am" isn't)
 semantics: a set of rules determining if a certain phrase makes sense (e.g., "I ate a
doughnut" makes sense, but "A doughnut ate me" doesn't)

The IL is, in fact, the alphabet of a machine language. This is the simplest and most primary
set of symbols we can use to give commands to a computer. It's the computer's mother tongue.

A program written in a high-level programming language is called a source code (in contrast to
the machine code executed by computers). Similarly, the file containing the source code is called
the source file.

4-Compilation vs. Interpretation


Computer programming is the act of composing the selected programming language's
elements in the order that will cause the desired effect. The effect could be different in every
specific case - it's up to the programmer's imagination, knowledge and experience.

Of course, such a composition has to be correct in many senses:

 alphabetically - a program needs to be written in a recognizable script, such as Roman,


Cyrillic, etc.
 lexically - each programming language has its dictionary and you need to master it;
thankfully, it's much simpler and smaller than the dictionary of any natural language;
 syntactically - each language has its rules and they must be obeyed;
 semantically - the program has to make sense.

It defines how hosts and network devices connect to the LAN.

You might also like