1. Introduction to Python
Python is a popular programming language.
It is used for:
- Web development
- Create workflows
- System scripting
- Machine learning
- Connect to database systems and perform tasks
- Read and modify files etc.
Why Python
- Python works on different platforms (Windows, Mac, Linux, etc.).
- Easy to understand with simple syntax. Almost similar to English language.
- Python runs on an interpreter system, meaning code can be run as soon as it is written.( no need to compile the code as we doe C#, C programming language)
2. Install Python on Windows
- Download Python from https://www.python.org/.
- As a developer, you write Python (.py) files in a text editor and then put those files into the Python interpreter to be executed.
- To test a short piece of code, the quickest and easiest way is to write code in the Python Command Line directly instead of writing code in a file and executing it.
Download Python
Before installing check if python installed in system or not
Go to CMD –>Type python –version
Install it –> Double click on the downloaded file –> install Now
Python added now in the system
if you not able to find python on cmd
Add system Variable.
If it is added in user variables than add both path in system variable also
add path in system variable as shown below:
Now check the python from cmd, Now you will able to see it
If you want to run python scripts, write the command in python files i.e .py and run as python filename.py
Different way to print the python code
Also you can open python ide and print the code
3.Get Started Python with Visual Studio Code
Choose a Python editor or IDE: There are many editors and IDEs available for Python development, but VS Code is a popular choice because it’s free, open-source, and extensible.
Install Visual Studio Code: You can download VS Code from the official website [Download Visual Studio Code].
Install the Python extension for VS Code: Once you have VS Code installed, you need to install the Python extension to enable Python development features. You can install extensions from the VS Code Marketplace [VS Code Marketplace].
Create and run a sample Python program: Once you have the Python extension installed, you can create a new Python file and write your first program. VS Code provides features like syntax highlighting, IntelliSense, and debugging to help you write and run Python code.
lists various Python editors and IDEs.
- PyCharm
- Sublime
- Atom
- Vim
- Spyder
- Visual Studio Code
Choosing the right editor or IDE depends on your experience and needs. Here’s a brief rundown to help you decide:
- PyCharm: A powerful, full-featured IDE with extensive support for web development, scientific computing, and data science. It’s great for professional use but can have a steeper learning curve for beginners.
- Sublime Text: A popular, lightweight code editor known for its speed and customization options. It requires plugins to get full Python support.
- Atom: Another extensible code editor similar to Sublime Text. It offers a user-friendly interface and a large community of developers.
- Vim: A modal text editor known for its efficiency and powerful command-line interface. It has a steep learning curve but can be highly productive once mastered.
- Spyder: A scientific Python IDE specifically designed for data science and scientific computing. It integrates well with popular data science libraries like NumPy, Pandas, and Matplotlib.
- Visual Studio Code: A free, open-source IDE known for its extensibility and large community. It offers great Python support through extensions and works well for various development projects.pen_spark
For Visual Studio Code (VS Code).
Install Visual Studio Code using below URL https://code.visualstudio.com/download
Go to extension and search for python extension and install it
Create python folder and open from the visual studio
create file .py inside the folder and run simple code as shown below