Python: Preamble
Tags: python, programming, objects
Published: 2020-11-25 06:29:12

This is the first post in the [**Becoming a Python Developer**](https://dev.to/mcscodes/series/9852) series! This series is intended towards everyone. Be it complete beginners or professional developers, the posts are sure to be helpful in grasping the concepts and a perfect launchpad for your Python journey! :smile:

# What is Python? Why is it gaining popularity?

In recent times, the need for a developer is a programming language that provides both **C-style** functional programming as well as **Java-style** object orientation. Whenever, functional aspects like calculations or processing is involved, C-style coding is preferred, while the need for classes and objects is completed by Java-style coding.

**Python** is an open-sourced programming language that combines the features of _C_ and _Java_. It has exceptional procedural as well as object-oriented capabilities. Having said this, always remember that everything in Python is an **object**.

### Some Features of Python

* **Simple and Easy to learn** - Learning Python is very simple compared to other programming languages.
* **Dynamically Typed** - In Python, we need not specifically declare the datatype of the variables used (unlike statically typed languages like C and Java).
* **Platform Independent** - When a Python program is compiled using a Python compiler, it generates byte code. Using a Python Virtual Machine (PVM), anyone can run the byte code instructions on any computer system.
* **Procedure and Object Oriented** - Python gives emphasis on the functions as well as objects.
* **Scripting Language** - A scripting language is a programming language that utilizes an Interpreter to translate the source code into machine code on the fly (while running). Other scripting languages include PHP, Bash, etc.
* **Database Connectivity** - Python provides Application Programming Interfaces (APIs) to connect its programs to all major databases like Oracle, MySql, SQLite Browser, etc.
* **Batteries Included** - Python contains several packages available for immediate use by developers. These packages make development easier due to the various features supported by them. Some of these packages include: **numpy** - for working with single and multi-dimensional arrays, **pandas** - for data analysis and data manipulation, **matplotlib** - for data visualization, etc.

### Some differences between **C** and **Python**

<table>
  <tr>
    <th>C</th>
    <th>Python</th>
  </tr>
  <tr>
    <td>It is a procedure-oriented programming language, and does not contain features such as objects, classes, etc.</td>
    <td>It contains features from procedure-oriented programming languages as well as object oriented programming languages.</td>
  </tr>
  <tr>
    <td>Program execution is faster.</td>
    <td>Slower execution of programs as compared to C. The PyPy flavor of Python programs run a bit faster.</td>
  </tr>
  <tr>
    <td>It is a statically-typed language (variable declaration with appropriate datatype is compulsory).</td>
    <td>It is a dynamically-typed language. Type declaration is not required.</td>
  </tr>
  <tr>
    <td>Memory allocation and deallocation requires user-intervention.</td>
    <td>Memory allocation and deallocation is done automatically by the PVM.</td>
  </tr>
  <tr>
    <td>Indentation does not have any importance in C.</td>
    <td>Indentation plays a major role and the code blocks need to be correctly indented.</td>
  </tr>
</table>

### Some differences between **Java** and **Python**

<table>
  <tr>
    <th>Java</th>
    <th>Python</th>
  </tr>
  <tr>
    <td>Java is essentially an object-oriented programming language.</td>
    <td>Python blends functional programming features with the object-oriented approach of programming.</td>
  </tr>
  <tr>
    <td>Java programs are verbose (contain many lines of code).</td>
    <td>Python programs are concise and compact, and very few lines of code are required to achieve any specified task.</td>
  </tr>
  <tr>
    <td>It is compulsory to declare the datatypes of the variables, arrays, etc. (statically-typed language)</td>
    <td>Type declaration is not required in Python (dynamically-typed language).</td>
  </tr>
  <tr>
    <td>Memory allocation and deallocation is done by JVM (Java Virtual Machine).</td>
    <td>Memory allocation and deallocation is done by PVM (Python Virtual Machine).</td>
  </tr>
  <tr>
    <td>Indentation does not have any importance in Java. It is required only for better readability of the code.</td>
    <td>Indentation plays a major role in Python, and improper indentation may lead to errors in the program.</td>
  </tr>
</table>