Search This Blog

What is computer program? | What is Programming Language? | What is Object Oriented Programming? | What is Python?

What is a computer program?
A computer program is a series of instructions, whereas the instructions are the tasks that need to be performed. Hence a computer program is a collection of tasks that a computer needs to work upon. Series of instructions tell the computer what to do next.

As Computer is unable to understand human language, so we need translation to translate human language into computer understandable language that is in
binary language.

There are two types of translators
  • Interpreter – Translate the instructions line by line 
Pros – Easy to debug the program
Cons – execution time is more.
  • Compiler – Translate whole the instructions at a time.
Pros – Difficult to debug the program.
Cons – execution time is
less.
What is a Programming Language?
Programming Language is a way to give instruction to the computer.
Integrated Development Environment (IDE)- is an environment with protocols to write a computer
program. It has many built-in functions to perform a specific task.

There are two types of Programming Languages


High-Level Language (HLL) – It is closer to human language.
Ex- C, C++, Python, et cetera.
Low-Level language (LLL) – It contains the basic instructions that can be recognized by a computer. The two common types of LLL is
  • Machine Language
  • Assembly Language.

What Is Object-Oriented Programming?
OOP is a programming paradigm which focuses on the objects that need to be manipulated rather than the logic required to manipulating them
It is based on the concept of "objects – a variable, a data structure, a function", which can contain “data”, in the form of fields - attributes or properties, and code, in the form of “Behaviours or procedures - methods”
OOP = Object (attributes or properties) + Code (behaviours or procedure)
OOP is a programming paradigm, or a specific way of designing a program, with both properties and behaviors. 

Attributes or Properties are the states of the object. This is the data that the object stores.
Behaviors or Procedures of the object are the actions that an object can take.

What is Python?

Python is an open-source written in “C language”, “mainly interpreter” based, object-oriented, high-level programming language.

Developed by “Guido van Rossam” in 1991, and in 2008 python 3 was introduced.

Difference between Python 2 & Python 3

Division operator:
Python 2.x:  7/5 = 1         # no automatic integer to float conversation
Python 3.x: 7/5 = 1.4      # automatic integer to float conversation

Print function
Python 2.x: print ‘Hello World’
Python 3.x: print(‘Hello World’)    #space after ‘print’ keyword is removed and has to use with parentheses.

Unicode
Python 2.x: implicit str type is ASCI
Python 3.x: implicit str type is Unicode.

xrange()
Python 2.x: exist
Python 3.x: range() is exist instead of xrange()

Error Handling
Python 2.x:  “try” is used.
Python 3.x:  “except” is used

CPython – written in C programming language, and it is officially from python.org, so if anyone is talking about python its means he is talking about “CPython”.

Jython project  – Python for java platform is a translator, written in java programming language.

Pypy –  is a translator written in python itself.

Iron Python – Python for a .NET platform is a translator, written in .NET

Python code example:

print (“Hello World”)

The interpreter converts this code into bytecode which prints "Hello World" on the screen:

0 LOAD_GLOBAL 0(PRINT)
2 LOAD_CONST 1(“Hello World”)
4 CALL_FUNCTION    1
6 POP_TOP
8 LOAD_CONT 0 (None)
10 RETURN_VALUE
 
 

Post a Comment

0 Comments