Python 3x Pandas Django

Python Tutorial


What is a computer programming languages?

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.

Translator

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:

1. Compiler

2. Interpreter

3. Assembler

1. Compiler

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.

2. Interpreter

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.

3. Assembler

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:

TranslatorProgramming Languages
Compiler1. Microsoft Visual Studio,
2. Common BusinessOriented Language (COBOL)
Interpreter1. Python,
2. JavaScript
Assembler1. 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 Translator

What is Python?

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),

  • Software Development,

  • Scientific & Research,

  • Mathematics,

  • System Scripting

Use Python for…


Why Python?

  1. Python has a simple syntax similar to the English language.

  2. Python has a syntax that allows developers to write programs with fewer lines than some other programming languages.

  3. Python works on Windows, Mac, Linux, Raspberry Pi, etc.

  4. Python runs on an interpreter system, meaning that code can be executed as soon as it is written.

  5. Python can be treated in a procedural way, an object-oriented way, or a functional way.


Keys points to be noted for Every Python Programmers:

  1. Indentation

  2. Syntax

  3. Keyword

  1. Python is the concept of Indentation

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.

Python Indentation
  1. Syntax

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

  1. Keywords

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.


Examples:

if, for a conditional statement

True\False, a Boolean value, the result of comparison operations

The complete list of keywords available in python docs


Python Syntax:

Python CodeDefinition
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

Try it yourself:

Some important terms in python

Expressions vs Statements

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!