Python Overview

This tutorial will provide a complete Python overview. Nowadays Python is one of the very popular language. Python is developed by Guido van Rossum, and released in 1991.

It is a high-level, interpreted and object-oriented scripting language.

Python 3 is an enhanced version of Python 2 programming language which released in 2008.

In case of Python code compilation not required as it execute directly at runtime.

Python is easy to learn and work, It is portable, scalable and extendable. It provides multiple libraries to connect with database and process large amount of data.

Python 3 code is not completely backward compatible with Python 2 code. Due to this, everyone got stuck using Python 2. Early Python 3 was slower. They improved the features and made it faster for the future.

Java and JavaScript shows lots of similarities with Python.

Python can be used as:

  1. Server side programming
  2. Software development
  3. scripting language

It is majorly supported by most of the operating systems.

Python Indentation

It doesn’t depend on semicolons to execute a statement. It considers a single line a statement as executed. For Python, changing a line is a new statement.

Python completely works on indentation, use whitespace to define scope.

It is recommended to use 4 spaces in place of giving a tab to maintain indentation and avoid compile time errors.

If code is not properly indented, it will give us the below error:

OUTPUT:

If code indentation is properly done, it will not cause any issues.

OUTPUT:
hello

Python Quotes

Python provides three type of quotes as single( ‘ ), double ( “ ) and three triple(‘ ’ ’, “ ” ” ) quotes.  

Single and double quote use for single line string assignment.

triple quote use for multiple line string assignment such as multiline paragraph.

Example

OUTPUT:

Variable Naming Convention

  1. Variable name must be start with alphabet letter or underscore(_).
  2. Variable name can not start with numeric digit.
  3. Only underscore is allowed, no other special characters are allowed (!, #, $, %, ^, &, *).
  4. Variable name can not be on keyword’s name supported by Python.
  5. Variable names are case sensitive. for example, mycar, myCar and my_car are totally different variables.

Valid variables

my_ca, _my_car, myCar, my_car_1

Invalid variables

1_my_ca, 1macar, my%car, my#car

Python variable name can be camel case, pascal and snake case. 

Camel Case: First letter will always be small letter and next letter of starting word will always be capital. e.g. carName, carEngineType

Pascal Case: It is like camel case with one difference where first letter will always be capital. e.g. CarName, CarEngineType 

Snake Case: all letters will be small and words separated by underscore(_). e.g. car_name, car_engine_type.

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan