Features Of Python
Enlisted below are the various features of Python:
- Simple and Easy to Learn: Python is simple and easy to learn, read and write.
- Free and open source: Python is a free and open source software which means that a user can edit, modify or reuse the software's source code. This gives the programmers an opportunity to improve the program functionality by modifying it.
- Interpreted Language: Python is an interpreted language, which means when we execute a python program, the interpreter executes the code line by line at a time. This makes debugging easy and thus is suitable for beginners.
- Python is Interactive: Interactive mode is a command line shell which gives immediate response for each statement.
- Portable: Python supports many platforms like Linux, Windows, MacOS, and Solaris.
- Object-Oriented: Python supports Object-Oriented technique of programming which provides a means of structuring programs so that properties and behaviors are bundled into individual objects.
- Supports different programming models: Python supports procedure-oriented programming as well as object-oriented programming.
- Flexible: Python code can invoke C and C++ libraries and can be called from and C++ programs, and can integrate with Java and .NET components.
Python Installation and Setting Path in Windows
Python can be downloaded from its official site:
- To download in your system go to Download Python page and click Download Python.
- Once the download is completed, open the .exe file and follow the on-screen instruction to install it.
- Once Python is installed in your system, a graphical user interface program IDLE is also installed along with it to work with Python.
Follow the below steps to set path in windows:
Click on This PC or My Computer from your Desktop
Right-Click on This PC or My Computer
Select Properties
Click on Advanced system settings on the left side of the properties window
Select Environment variables under the advanced tab
Under System variables select the variable “PATH”
Click on Edit
Click on New
Give the path of the location where Python is installed and click on OK
My computer => Right click => Select Properties => Click on Advanced system settings => Select Environment variables under Advanced tab => Under system variables select the variable “PATH” => Click on edit => Click on New => Give the path of location where python is installed.
Once an Environmental variable is set successfully, we can check if python is installed correctly or not in the command prompt by simply typing “Python”.
Basic Syntax
If you are familiar with another programming language, then you will be familiar with the curly brace and semicolon.
In Python, we need not worry about these two for statement separation and block of code separation. In python, everything will be indented.
Interactive Mode
Print (“Hello World”)
We can print the below statement in an interactive mode as mentioned in the below screenshot.
Script/Normal mode
#1) Open the editor in Normal mode.
#2) Write the statements that you want to execute.
#3) Save the file as filename.py
#4) Open the Command prompt.
#5) Go to the location where the file is saved.
#6) Now run the file as python filename.py as mentioned in the screenshot.
Conclusion
- Python is a general-purpose programming language and if you are just beginning your programming career, then python suits best for you.
- In Python, variables do not need a declaration to reserve the memory space. “Variable declaration” happens automatically when we assign a value to a variable.
- Like any other programming language python also supports 6 standard data types which consist of both mutable and immutable features.
- Numbers, string and tuple are immutable data types whereas list, Dictionaries and sets are mutable data types.
- Python also supports 7 different types of operators and by using these operators we can perform various operations like Arithmetic, Comparison, Logical, Bitwise, Assignment, Identity, Membership on 2 or more operands.