Computer programming languages allow us to give instructions to a computer in a language the computer understands(Machine Code 0 & 1). Just as many human-based languages exist, English, French, Hindi, and Tamil.
A translator is a programming language processor that converts a computer program from one language to another. It takes a program written in source code(like Python, Java, JS..) and converts it into machine code 0 & 1. It discovers and identifies the error during translation.
There are 3 different types of translators as follows:
A compiler is a translator used to convert high-level programming language to low-level programming language. It converts the whole program in one session and reports errors detected after the conversion. Compiler takes time to do its work as it translates high-level code to lower-level code all at once and then saves it to memory.
Just like a compiler, is a translator used to convert high-level programming language to low-level programming language. It converts the program one at a time and reports errors detected at once, while doing the conversion. With this, it is easier to detect errors than in a compiler. An interpreter is faster than a compiler as it immediately executes the code upon reading the code.
An assembler is a translator used to translate assembly language to machine language. It is like a compiler for the assembly language but interactive like an interpreter. Assembly language is difficult to understand as it is a low-level programming language.
Some examples of translators per type:
|Compiler||1. Microsoft Visual Studio, |
2. Common BusinessOriented Language (COBOL)
|Assembler||1. Macro Assembly Program (MAP),|
2. Symbolic Optimal Assembly Program (SOAP)
Python usually uses an interpreter and an interpreter just like a translator goes line by line through your code and executes source code on our machine.
Python is a popular programming language that lets you work quickly and integrate systems more effectively. It was created by Guido van Rossum, and released in 1991.
It is used for:
Web Development (server-side),
Scientific & Research,
Use Python for…
Python has a simple syntax similar to the English language.
Python has a syntax that allows developers to write programs with fewer lines than some other programming languages.
Python works on Windows, Mac, Linux, Raspberry Pi, etc.
Python runs on an interpreter system, meaning that code can be executed as soon as it is written.
Python can be treated in a procedural way, an object-oriented way, or a functional way.
In most programming languages, indentation is used to properly structure the code. In contrast, python used for grouping the block of code, making the code automatically structured and easy to read.
The syntax is the set of rules that defines the combinations of symbols that are considered to be correctly structured statements or expressions in programming languages
Keywords are part of the syntax. It is predefined, reserved words used in a programming language that have special meanings to the compiler and cannot be used as an identifier.
if, for a conditional statement
True\False, a Boolean value, the result of comparison operations
The complete list of keywords available in python docs
|print("Hello World")||Display a string|
|print("Welcome to World Largest Python Exercise Site ", "IBMMainframer.com")||Display multiple strings|
|print("Hello" + " World")||Join\Append two words|
|# Single line comment section||#|
|""" Multiple Line comment section """||Within """ """|
|print(1 + 1)||Arithmetic Operation|
Expression is a combination of variables, operations and values that yields a result value.
1 + 2 100 / 10 (2**2 + 1) * (3 + 7)
A statement does something. Statements represent an action or command e.g print statements, assignment statements.
print(1 + 2) Grade = 100 / 10 print((2**2 + 1) * (3 + 7))
If you have any doubts or queries related to this chapter, get them clarified from our Python Team experts on ibmmainframer Community!