PYTHON-INTRODUCTION

What is programming?

Python Introduction

Advantage

High-level Languages

High-level languages, like C, C++, JAVA, Python etc., are very near to English. It makes programming process easy. However, it must be translated into machine language before execution. This translation process is either conducted by either a compiler or an interpreter. Also known as source code.

Machine Code

Machine languages are very close to the hardware. Every computer has its machine language. A machine language programs are made up of series of binary pattern. (Eg. 110110) It represents the simple operations which should be performed by the computer. Machine language programs are executable so that they can be run directly.

Compiler

A Compiler transforms code written in a high-level programming language into a machine code or any other Intermediate code. It converts the text that a programmer writes into a format the CPU can understand. The conversion manner is different .It converts the Entire source code in one go and reports all the errors of the program along with the line numbers. After all the error are removed, the program is recompiled and after that the Compiler is no needed in memory as the object program is available.

Interpreter

The interpreter converts the source code line-by-line during Run Time, translates it into machine code or virtual machine code. Interpreter allows evaluation and modification of the program while it is executing. If there is error in any line, it reports it at the same time and program execution cannot resume until the error is rectified .Interpreter must always be present in the memory every time the program is run.it is first interpreted and then executed.

Difference between compiler VS Interpreters

CompilerInterpreter
It read the whole program at a time.It read the program line by line.
It translates the whole program at a time into machine code.It translates only one line of program at a time into machine code.
It produces machine code which is directly understood by computer.It produces intermediate code after translation.
It takes large amount of time to analyze the source code.It takes less amount of time to analyze the source code.
it is fasterit is slower.
It requires more memory space.It requires less memory space.
Programming language like C, C++ use compiler.Programming language like Python, Ruby use interpreter.