Python is an interpreted programming language; this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed.
In addition to this you can also use "Visual Studio" or "Visual studio code" to execute your python code. Only you need to take care that latest Python version must be installed on your machine.
In this sample code I'll use Visual Studio 2019. While installing visual studio I select the python option. This will allow you to create Python project using Visual studio. Once you'll run the code it will ask you to install python.exe then you can install if it is not present on your machine. Please install it for all users and also check set environment variable check box while installing. That's it.
Adding new Python page:
- Go to Visual Studio-> select create new project option -> select Python language and create project.
- Now right click on your project and add new python file as shown below.
- Now helloWorld.py file will get added to your solution.
- Open file and type print("Hello, World!") and save it.
- Run using run button or press F5, you will see output in console as shown below.
Check Python Version:
To check the Python version of the editor, you can find it by importing the sys
module. We'll learn how to import custom modules in our coming tutorials.
import sys
print("-"*60) #it will print a line with hyphen
print(sys.version)
print("-"*60)
Different flavors of Python:
Flavors of python refer to the different types of python compilers. These are useful to integrate various programming languages.
- CPython: Standard python compiler implemented in C language. This is the python software being downloaded and used by the programmers directly.
- Jython: Initially called as JPython, later renamed to Jython. Designed to run on a Java program.
- IronPython: Designed for .NET framework.
- PyPy: The main advantage of PyPy is performance will be improved because the JIT compiler is available inside PVM.
- RubyPython: This is a bridge between Ruby and Python interpreters. It encloses a python interpreter inside the Ruby application.
- AnacondaPython: Anaconda is a free and open-source Python programming language. This is mainly for data science and machine learning-related applications (large-scale data processing, predictive analytics, scientific computing). This aims to simplify package management and deployment.
Compiler vs Interpreter:
All the programming languages are converted to machine understandable language for execution. The conversion is taken care of by compilers and interpreters.
Interpreter: - An interpreter is one that runs the code line by line and executes instruction by instruction. The languages which use interpreters are called Interpreted languages. Such languages are slower in terms of execution and less efficient. Examples – PHP, Python, Ruby.
Compiler: - A compiler is one that takes the source code and converts it into machine-executable code at once. The processor takes the executable and executes it. The languages which use a compiler are called compiled languages. Compiled languages are faster and more efficient comparatively. Examples – C++, Java
High-level language vs low-level language
High-level language: -High-level programming languages are those which are programmer friendly. Humans can easily understand it which helps in easy maintaining and debugging of the code. These types of languages need a compiler or interpreter for execution. High-level languages are the most commonly used languages. Examples – C, C++, Python and Java.
low-level language: -Low-level programming languages are those which are machine friendly. Humans can’t understand such languages. In other words, low-level languages are NOT human-readable. So, these languages, comparatively, are complex to debug. An assembler is required to debug these types of languages. Examples – Assembly language, Machine language.
We are starting a Python Tutorials Series for Beginners and Professionals. In these Python Tutorials, we will cover all the features of Python. You will learn from basic to advanced-level features of Python as we progress in these Python Tutorials.
What is Python?
Python is a popular programming language. It can be used on a server to create web applications. It is a high-level, interpreted, general-purpose programming language emphasizing on readability and simplicity. It was created by Guido van Rossum and first released in 1991. Python philosophy revolves around code readability, and it provides constructs that enable clear programming on both small and large scales projects.
Key Features of Python:
- Easy to Read and Write: Python offers clear syntax and readability, which makes it an excellent choice for beginners & professionals in programming.
- High-Level Language: Python handles a lot of complexity for the users; hence it is very user-friendly because you do not need to manage the memory cleaning by yourself, unlike lower-level languages
- Open Source with large Community: Python is an open-source language with an active community contributing to its development and offering extensive support. Which makes it as first choice.
- Wide Range of Applications: Python is used in various domains for example web development with Django, Flask, scientific and numeric computing using SciPy, NumPy, desktop graphical user interfaces using Tkinter, PyQt and software development, and system automation.
- Dynamic Typing: Python is dynamically typed, which means that you don’t have to declare the type of a variable when you create one. The type is determined at runtime.
- Interpreted Language: Python is processed at runtime by the interpreter. You do not need to compile your program before executing it, unlike languages like C or Java.
- Cross-Platform Compatibility: Python interpreters are available for many operating systems, making Python programs cross-platform.
What can Python do?
- Python can be used on a server to create small & large web applications.
- Python can be used alongside software to create workflows.
- Python can connect to database systems along with this it can also read & modify files data.
- Python can be used to handle big data and perform complex mathematics calculations.
- Python can be used for rapid prototyping, or for production-ready software development.
Why the Name Python?
In 1970s there was a TV show named "Monty Python's Flying Circus". While making Python code, Guido moreover utilized to study this show's distributed scripts. As Guido required a brief and a distinctive title for this new language then, finally he named it Python.
Benefits of Learning Python?
- Ease of Learning: Python is renowned for its simplicity and readability. Its syntax is clear and concise, making it an ideal first language for beginners. It’s also powerful enough for advanced programming, making it a great choice for all levels of expertise.
- Strong Demand in the Job Market: Python’s popularity in various sectors, including data science, machine learning, and web development, has led to a strong demand for Python developers in the job market.
- Community and Support: Python has a large and active community, which means plenty of resources, tutorials, and forums for learning and troubleshooting. This community support is invaluable for both beginners and experienced programmers.
- Automation and Scripting: Python is an excellent tool for automating repetitive tasks and scripting to increase efficiency and reduce the time spent on routine tasks.
- Rapid Prototyping: Python’s simplicity and the vast array of libraries available make it an excellent choice for rapid prototyping and experimentation.
- Web Development: With frameworks like Django and Flask, Python is also a strong candidate for building web applications, offering robustness and scalability.
Key points of Python Syntex:
- Biggest point is Python relies on indentation, using whitespace, to define scope, such as the scope of loops, functions and classes. Other programming languages often use curly brackets "{ }" for this purpose.
- Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons ";"or parentheses "()".
- Python was designed for reusability, readability and has some similarities to the English language with influence from mathematics and syntax are easier to learn.
History & Versions of Python:
- Python 1.x - Python 1.0 was the first official version of Python & it was released by Guido van Rossum in January 1994.
- Python 2.x - Python 2.0 was first launched in Oct 2000 and then went up to 2.7 version (July 2010).
- Python 3.x - Currently Python 3.13.7 is the latest stable version . Python 3.14 Pre Release is also available now.