1. Python
  2. Getting Started

Getting Started with Python

Last updated:

Powerful, high-level, and versatile programming language that has gained immense popularity among developers, data scientists, and hobbyists.

Why Python?

  • simplicity and readability
  • strong support for integration with other languages
  • vast library of modules and packages allows for rapid development
  • cross-platform compatibility
  • active community and third-party libraries
  • easy-to-read syntax
  • object-oriented and functional programming paradigms
  • interpreted language, making it easy to test and debug code
  • dynamic typing and automatic memory management
  • extensive support for data analysis, machine learning, and artificial intelligence

Syntax

Python syntax is designed to be easy to read and understand, with a focus on simplicity and minimalism.

  • Indentation: Unlike other programming languages, Python relies on indentation. A consistent number of spaces or tabs (usually 4 spaces) are used to indicate the beginning and end of code blocks.
  • Comments: start with a hash symbol (#)
  • Line continuation: To split a long line of code into multiple lines for readability, use a backslash () at the end of a line or enclose the expression in parentheses.

Installing Python

Official website at https://www.python.org/downloads/.

After installing Python, you can check if it’s installed correctly:

python --version
Python 3.12.4

Running Your First Python Script

With a file named hello.py and with the following content:

print("Hello, World!")

To run the script, enter the following command:

python hello.py
Hello, World!