1 Unit 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

INTRODUCTION TO

COMPUTING (USING
PYTHON)
EVOLUTION OF PROGRAMMING LANGUAGES,
SOFTWARE REQUIREMENTS FOR PROGRAMMING
Programming Languages

 First Generation = low-level languages like machine language


 Second Generation = low-level assembly languages used in kernels
and hardware drives
 Third Generation = high-level languages like C, C++, Java, Visual
Basic, and JavaScript
Programming Languages

 Fourth Generation = These are languages that consist of statements that are
similar to statements in the human language. These are used mainly in database
programming and scripting. Examples of these languages include Perl, Python,
Ruby, SQL, MatLab(MatrixLaboratory)
 Fifth Generation = programming languages that have visual tools to develop a
program. It is based on the concept of artificial intelligence. Examples of fifth-
generation languages include Mercury, OPS5, and Prolog, LISP
EVOLUTION OF LANGUAGES
LOW-LEVEL LANGUAGES

• Low-level languages are languages that sit close to the computer's instruction set. An instruction set is
the set of instructions that the processor understands.
• A low-level language may also be referred to as a computer’s native language
• It is very close to writing actual machine instructions, and it deals with a computer's hardware components
and constraints
• In contrast to high-level language that used for developing software, low-level code is not human-readable,
and it is often cryptic.
Two types of low-level language are:
• Machine code/language
• Assembly language
MACHINE LANGUAGE

• Machine code is the set of instructions that a CPU understands directly and can act
upon. A program written in machine code would consist of only 0s and 1s -
binary. This is very difficult to write and debug. Even a very simple program could
have thousands of 0s and 1s in it.
• All programs and programming languages eventually generate or run programs in
machine language.
• Machine language is made up of instructions and data that are all binary numbers.
Machine language is normally displayed in hexadecimal form so that it is a little bit
easier to read.
ASSEMBLY LANGUAGE

• Assembly language sits between machine code and high-level language in terms of ease of use. While
high-level languages use statements to form instructions, assembly language uses mnemonics - short
abbreviations. Each mnemonic directly corresponds with a machine code instruction. Here are some
examples of mnemonics:
ASSEMBLY LANGUAGE

• In assembly language, programmers write programs as a series of mnemonics. Mnemonics are much
easier to understand and debug than machine code, giving programmers a simpler way of directly
controlling a computer.
• Writing in mnemonics is easy for programmers because they are usually brief representations of the
actual commands. They are quicker to write than binary, and it is easier to spot mistakes.
• Little Man Computer (LMC) is a simulation of a very basic processor using Von Neumann
architecture. It uses an example of simple assembly language that contains a limited set of
mnemonic instructions which can be used to program simple assembly programs. LMC is freely
available on the internet for students to use.
ASSEMBLY LANGUAGE

• The machine languages need no translators. It is because they are


already present in machine-understandable form
• Assembly languages need translators (also known as assemblers) for
converting the mnemonics into a machine-understandable form
https://peterhigginson.co.uk/LMC/
HIGH LEVEL LANGUAGE

• High-level languages allow programmers to write instructions in a language that is


easier to understand than low-level languages.

• Translators are needed to translate programs written in high-level languages into


the machine code that a computer understands.
HIGH LEVEL LANGUAGE

• The instructions that tell a computer what to do are written in machine code. Machine
code is a series of numbers written in binary. Each number represents a different instruction.
• Programmers find machine code difficult to learn, program in and debug. As a result, the
majority of programmers write programs in high-level programming languages. These
languages are close to natural language - the spoken and written language of humans.
• For example, Python uses 'print', ‘if’, 'input' and 'while' statements - all words from the
English language - to form instructions. In fact, instructions often look like abbreviated English
sentences.
HIGH LEVEL LANGUAGE

• Programmers write in high-level languages because they are easier to understand


and are less complex than machine code. They allow the programmer to focus on
what needs to be done, rather than on how the computer actually works.
• For example, in many high-level languages, to place a message on the screen, a
programmer would use the statement 'print'. The programmer might not know
how the computer actually generates the message. They just need to know how to
use the 'print' statement.
HIGH LEVEL LANGUAGE

Commonly used high-level languages


Many types of high-level language exist and are in common use today, including:
• Python
• Java
• C++
• C#
• Visual Basic
• JavaScript
https://dev.to/codicacom/top-8-most-in-demand-programming-
languages-for-2021-3c28
Python
Current trends in programming languages show Python’s relevance for machine
learning, data science, and the IoT.

Advantages
• Simple and plain syntax;
• Wide range of libraries;
• Open-source nature.
Disadvantages
• Moderate execution speed;
• Extensive memory consumption;
• Not suitable for mobile development.
Python

What is Python used for? Python is one of the top programming languages for
The latest programming language trends claim web development. The countless number of
Python to be especially effective for such domains: websites and different platforms built with its help
• Web development; only prove this fact. Let’s mention some of them:
• Desktop apps development; • Instagram;
• Machine learning; • Google;
• Neuroscience; • Spotify;
• Medicine; • Netflix;
• Pharmacology; • Uber;
• Astronomy. • Dropbox;
• Pinterest.
SOURCE CODE

• Source code is the term given to a set of instructions that are written in
human readable programming language
• Source code must be translated into machine code before a computer can
understand and execute it
TRANSLATORS

• Any program written in a high-level language is known as source code. However,


computers cannot understand source code. Before it can be run, source code must first
be translated into a form which a computer understands.
• A translator is a program that converts source code into machine code. Generally,
there are three types of translator:
• compilers
• interpreters
• assemblers
COMPILERS

• A compiler takes the source code as a whole and translates it into machine code all in one go. Once converted, the
object code can be run unassisted at any time. This process is called compilation.
• Compilers have several advantages:
• Compiled programs run quickly, since they have already been translated.
• A compiled program can be supplied as an executable file. An executable file is a file that is ready to run. Since an
executable file cannot be easily modified, programmers prefer to supply executable rather than source code.
• Compilers optimise code. Optimised code can run quicker and take up less memory space.
• Compilers also have disadvantages:
• The source code must be re-compiled every time the programmer changes the program.
• Source code compiled on one platform will not run on another - the machine code is specific to the processor's
architecture.
INTERPRETERS

• An interpreter translates source code into machine code one instruction at a time. It is similar to a human translator translating what a
person says into another language, sentence by sentence, as they speak. The resulting machine code is then executed immediately. The
process is called interpretation.
• Interpreters have several advantages:
• Instructions are executed as soon as they are translated.
• Errors can be quickly spotted - once an error is found, the program stops running and the user is notified at which part of the program
the interpretation has failed. This makes interpreters extremely useful when developing programs.
• Interpreters also have several disadvantages:
• Interpreted programs run slowly as the processor has to wait for each instruction to be translated before it can be executed.
• Additionally, the program has to be translated every time it is run.
• Interpreters do not produce an executable file that can be distributed. As a result, the source code program has to be supplied, and this
could be modified without permission.
• Interpreters do not optimise code - the translated code is executed as it is.
ASSEMBLERS

• Assemblers are a third type of


translator. The purpose of an assembler
is to translate assembly language into
machine code.
• Whereas compilers and interpreters
generate many machine code
instructions for each high-level
instruction, assemblers create one
machine code instruction for each
assembly instruction.
LINKER AND LOADER

• Linker or link editor is a computer utility program that takes one or more object files
generated by a compiler and combines them into a single executable file, library file, or
another 'object' file.
• Loader is the part of an operating system that is responsible for loading programs and
libraries. It is one of the essential stages in the process of starting a program, as it places
programs into memory and prepares them for execution. It is special program that
takes input of executable files from linker, loads it to main memory, and prepares this code
for execution by computer. Loader allocates memory space to program
LINKER AND LOADER
SOFTWARE REQUIREMENTS

Operating System is an interface between the


user of the computer and the hardware
OPERATING SYSTEM

• An operating system is the most important software that runs on a computer. It


manages the computer's memory and processes, as well as all of
its software and hardware.
• It also allows you to communicate with the computer without knowing how to speak
the computer's language.
• Most of the time, there are several different computer programs running at the same
time, and they all need to access your computer's central processing unit
(CPU), memory, and storage. The operating system coordinates all of this to make
sure each program gets what it needs.
TYPES OF OPERATING SYSTEMS

• Operating systems usually come pre-loaded on any computer you buy. Most people
use the operating system that comes with their computer, but it's possible to upgrade or
even change operating systems. The three most common operating systems for personal
computers are Microsoft Windows, macOS, and Linux.
• Modern operating systems use a graphical user interface, or GUI. A GUI lets you
use your mouse to click icons, buttons, and menus, and everything is clearly displayed
on the screen using a combination of graphics and text.
PYTHON

• Interpreted language
• Means source code of python program is converted into bytecode that is then run by
Python virtual machine.
• Python code is not required to be built and linked like code for other languages like C,
C++
• The standard Python Interpreter is itself written in C language, called CPython
Output in Python Shell
The Python interpreter first reads the human code and
optimizes it to some intermediate code before
PYTHON INTERPRETER interpreting it into machine code.
Under the hood, though, a bit more happens. Specifically, your code is first compiled to something
called “byte code” and then it is passed to a “virtual machine”.

Byte code is basically a low-level representation of your source code. The source
code is translated to byte code because byte code can run much more quickly than the original source
code.

The interpreter does not expose this translation process to the Python programmer.

Now, this newly generated byte code goes off for execution to the Python Virtual Machine (PVM). PVM
is not a separate program, it is in fact always present as a part of Python’s system.

Python Virtual Machine is the runtime engine of Python. It goes through your byte code instructions one by
one and carries out the operations stated in those instructions.

Technically, the execution of your byte code by PVM is the ‘Python Interpreter’ last step.

https://www.programiz.com/python-programming/online-compiler/
PYTHON IS CASE SENSITIVE LANGUAGE
ChatGPT

 An AI chatbot
 AI research company OpenAI
 To spot errors in codes
THANK YOU

You might also like