Skip to main content

Introduction to Python

Python Introduction

  • Python is a high-level programming language known for its simplicity, readability, and versatility.
  • It was created by Guido van Rossum and first released in 1991.
  • Python has gained immense popularity over the years and has become one of the most widely used programming languages in various domains such as web development, data analysis, artificial intelligence, scientific computing, and more.

Features and characteristics of Python

Easy to Learn

Python has a relatively gentle learning curve, making it accessible for beginners. Its syntax is intuitive and resembles natural language, allowing programmers to write code in a more straightforward and understandable manner.

Interpreted Language

Python is an interpreted language, which means that the code is executed line by line rather than being compiled. This provides flexibility and allows for quick prototyping and debugging.

Platform Independence

Python is available on various operating systems, including Windows, macOS, and Linux. This portability makes it convenient to write programs that can run on different platforms without significant modifications.

Vast Standard Library

Python comes with a large standard library that provides numerous modules and functions for various tasks, such as file handling, networking, database access, and more.

Community and Support

Python has a thriving and supportive community of developers worldwide. This community actively contributes to open-source projects, shares knowledge, and provides assistance through forums, mailing lists, and online resources.

Python setup guide

Here's a step-by-step guide to setting up Python on your system:

Step 1: Choose a Python Version

Python has two major versions, Python 2.x and Python 3.x. It's recommended to use Python 3.x as Python 2.x is no longer actively maintained.

You can download the latest version of Python from the official Python website at https://www.python.org/downloads/.

Step 2 Download and Install Python

  • Go to the Python downloads page (https://www.python.org/downloads/) and click on the download link for the latest version of Python 3.x compatible with your operating system (Windows, macOS, or Linux).

  • Choose the appropriate installer based on your operating system (e.g., Windows installer, macOS installer, or source code for Linux).

  • Run the downloaded installer and follow the installation wizard instructions.

  • During the installation process, make sure to check the box that says "Add Python to PATH" or "Add Python to environment variables" (the exact wording may vary depending on your operating system). This will enable you to run Python from the command line easily.

Step 3: Verify the Installation

Once the installation is complete, you can verify if Python is properly installed on your system by opening a command prompt (Windows) or terminal (macOS/Linux) and typing the following command:

python --version

This command will display the installed Python version.

Step 4: Install a Text Editor or Integrated Development Environment (IDE)

To write and run Python code, you'll need a text editor or an integrated development environment (IDE). Here are some popular options:

  • Visual Studio Code (VS Code): A lightweight and highly customizable text editor with excellent Python support. You can download it from https://code.visualstudio.com/.
  • PyCharm: A powerful and feature-rich IDE specifically designed for Python development. The community edition is free and can be downloaded from https://www.jetbrains.com/pycharm/.
  • Atom: A hackable text editor with a rich ecosystem of extensions. You can download it from https://atom.io/.
  • Sublime Text: A lightweight and extensible text editor. It can be downloaded from https://www.sublimetext.com/. Choose an editor/IDE that suits your needs and preferences.

Step 5: Start Writing Python Code

Once you have Python installed and a text editor/IDE set up, you're ready to start coding in Python. Open your text editor/IDE, create a new file with a .py extension (e.g., hello.py), and start writing your Python code.

For example, you can start with a simple "Hello, World!" program:

print("Hello, World!")

Save the file and run it using the following command in the command prompt/terminal:

python hello.py

Congratulations!

You have successfully set up Python on your system and executed your first Python program.

check folder path

Make sure you have opened the terminal in same folder where your code hello.py exits