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:
It is majorly supported by most of the operating systems.
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 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:
my_ca, _my_car, myCar, my_car_1
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.
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.
📝 Blogs
javadoubts.com © All rights reserved