PYTHON unit1-notes2
PYTHON unit1-notes2
Once an algorithm for solving a given problem is developed or found, the next
important thing is a solution to the problem be found in a reasonable amount of
time?” If not, then the particular algorithm is of limited practical use.
------------------------------------------x-------------------------------------------
Computer Algorithms
Example:
------------------------------------------X-------------------------------------------------
Computer Hardware
It is essential that computer hardware be reliable and error free. If the hardware
gives incorrect results, then any program run on that hardware is unreliable.
We are used to representing numbers using base 10 with digits 0–9. In current
electronic computing, each digit is represented by a different voltage level.
In this representation, each digit can be one of only two possible values, similar
to a light switch that can be either on or off.
Main memory is where currently executing programs reside, which the CPU
can directly and very quickly access. Main memory is volatile; that is, the
contents are lost when the power is turned off.
An operating system acts as the “middle man” between the hardware and
executing application programs .
For example, it controls the allocation of memory for the various programs that
may be executing on a computer. Operating systems also provide a particular
user interface.
For example, in base 10, there are ten possible digits (0, 1, . . ., 9), in which
each column value is a power of ten. Other radix systems work in a similar
manner. Base 2 has digits 0 and 1, with place values that are powers of two.
-----------------------------------------------------X---------------------------------------
Computer Software
It actually tells the computer what to do and how to do it.This can be in the
form of instructions on paper, or in digital form.
System software
Application software
COMPUTER LANGUAGES
To write a program (tells what to do) for a computer, we must use a computer
language. Over the years computer languages have evolved from machine
languages to natural languages.
Language Machine:
The instructions in machine language must be in streams of 0‘s and 1‘s. This is
also referred as binary digits. These are so named as the machine can directly
understood the programs
Assembly Language:
High-Level Languages:
Such languages are considered high-level because they are closer to human
languages and further from machine languages.
Syntax, Semantics, and Program Translation
Program Translation
Writing programs at this “low level” is tedious and error-prone. Therefore, most
programs are written in a “high-level” programming language such as Python.
Since the instructions of such programs are not in machine code that a CPU can
execute, a translator program must be used.
Language Translators
These are the programs which are used for converting the programs in one
language into machine language instructions, so that they can be excuted by the
computer.
1) Compiler: It is a program which is used to convert the high level language
programs into machine language
-----------------------------------------X-------------------------------------------------
------------------------------------------------------------X-------------------------------------------------
------------------------------------------------------------------X--------------------------------------------------------------
------------------------------------------------------------X--------------------------------------------------------------