Basics Flashcards
Computers have their own language
Machine Language that are developed by humans
A complete set of known commands is called
Intstruction List
IL
example describe how to tie shoe
The difference, though, is that human languages developed naturally.
Moreover, they are still evolving, and new words are created every day as old words disappear.
Natural languages
Grunts to Shakespear and beyond
make up a language
ALLS
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)
Instruction List
ABC
Alphabet Soup
Alphabet of computers
We need a language in which humans can write their programs and a language that computers may use to execute the programs, one that is far more complex than machine language and yet far simpler than natural language.
high-level programming languages
typing code so that HAL understands
Source Code
Files that contain source code
Source Files
source code translated once and repeated each time it is modified) and contains the machine code and is distributable worldwide.
Compilation
the program that does the translation of the code worldwide is called
Compiler
Bulldog……. worldwide
you (or any user of the code) can translate the source program each time it has to be run
INTERPRETATION
Program running the INTERPRETATION is
Interpreter
Interpreter is much like the Enigma machine that requires both the user and the end user to
Have the interpreter. If that does not happen it does not work.
Let’s assume once more that you have written a program. Now, it exists as a
Computer File
piece of text - actually piece of text - that is actually part of the source code of a
program.
each text file is like madonna
pure text - like a virgin
Bulldog advantages worldwide
faster
only user needs compiler
data stored as machine language
Enigma Interpretation advantages
run code as soon as it is completed
code stored as computer language
Bulldog disadvantages
time comsuming
must have 1 compiler per h/w platform
Enigma disadvantages
not performant
both creator and end user need secret decoder book.
Monty Python speaks fluently with
interpreted language
To program the python you will need the
interpetor - cant run code without it
languages used in the interpretation - enigma machine - manner like python are called
scripting languages
the source programs that use interpretation manner much like enigma machine are called
scripts
Python was created by Guido Van Rossum and the name is based on Monty Python’s Flying Circus
Guido is doing his version of Ministry of Silly Walks..
Python Goals
easy (and intuitive)
open source
understandable
suitable for everyday tasks
EOUS
Python is EZ
learn
teach
use
understand
obtain
Python drawbacks
not performant
can be resistant to testing techniques
debugging can be a bitch - Grace Hopper hates that!
Python is most prevelent on
Internet Services - ISPS
Python used by scientists, testers and
everyday use application
Python has friends in low places and is not suitable for creating drivers
low-level programming.
Python is not used in mobile devices
This is the land of Android
Python2 and Python3 are not
Compatible and don’t talk to eachother
All versions of Python3 are
backwards compatible
like J. Jonah Jamesons supports you in writing code
editor
where to start and forcible stop code
console
launches code step-by-step and allows inspection at each moment of execution
debugger
Integrated Development Environment
IDLE
Error Output
the 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);
the 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;
the 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;
the name of the error and a short explanation.