Python module 1 Flashcards
Name four simplace actions to form a program:
Accept a number representing distance
Accept a number representing travel time
Divide the former value by the later and store the result in memory
Display the result (representing average speed) in a readable format
Machine Language is ____
Rudimentary
Instruction List
Sometimes Abbreviated IL. Different types of computers may vary depending of their ILs
Each Language (machine or natural) consists of the following elements:
An Alphabet
A Lexis
A syntax
Semantics
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)
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)
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
The alphabet of a machine language
A program written in a high-level programming language is called
a source
Source file
the file containing the source code
The two ways of transforming a program from a high-level programming language into machine language:
Compilation
Interpretation
Compilation
The source program is translated one (however, this act must be repeated each time you modify the source code) by getting a file (e.g., an .exe file if the code is intended to be run under MS Windows) containing the machine code; now you can distribute the file wordwide; the program that performs this translation is called a compiler or translator;
Interpretation
you (or any user of the code) can translate the source program each time it has to be run; the program performing this kind of transformation is called an interpreter, as it interprets the code every time it is intended to be executed; it also means that you cannot just distribute the source code as0is, because the end-user also needs the interpreter to execute it.
Text file
a computer program consisting of text after writing a program.
Pure text
without any decorations like fonts, colors, or embedded images or other media. Now you have to invoke the interpreter and let it read your source file