Python Part 1

Ace your homework & exams now with Quizwiz!

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)

syntactically

each language has its rules and they must be obeyed;

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;

content of the erroneous line

note: IDLE's editor window doesn't show line numbers, but it displays the current cursor location at the bottom-right corner; use it to locate the erroneous line in a long source code;

semantically

the program has to make sense.

COMPILATION

the source program is translated once (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 worldwide; the program that performs this translation is called a compiler or translator;

location of the error

(the name of the file containing the error, line number and module name); note: the number may be misleading, as Python usually shows the place where it first notices the effects of the error, not necessarily the error itself;

traceback

which is the path that the code traverses through different parts of the program - you can ignore it for now, as it is empty in such a simple code);

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 as-is, because the end-user also needs the interpreter to execute it. Due to some very fundamental reasons, a particular high-level programming language is designed to fall into one of these two categories. There are very few languages that can be both compiled and interpreted. Usually, a programming language is projected with this factor in its constructors' minds - will it be compiled or interpreted?

What is python?

Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming. And while you may know the python as a large snake, the name of the Python programming language comes from an old BBC television comedy sketch series called Monty Python's Flying Circus. Python was created by Guido van Rossum, born in 1956 in Haarlem, the Netherlands. Of course, Guido van Rossum did not develop and evolve all the Python components himself.

alphabetically

a program needs to be written in a recognizable script, such as Roman, Cyrillic, etc.

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)

alphabet

a set of symbols used to build words of a certain language


Related study sets

Psych Ch. 1: What is Psychology?

View Set

SCI 002 Introduction to Nutrition

View Set

Chapter 09: Assessing the Fetus NCLEX

View Set