Python is a high-level, interpreted programming language known for its simplicity, readability, and versatility. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming.
Python is widely used in web development, data science, automation, AI, scientific computing, and more. Its simple syntax makes it a great first language.
Download Python from python.org. Follow the instructions for your OS. Be sure to check the “Add Python to PATH” option during installation.
Python 3 is the future of the language and is not backward-compatible with Python 2. Always use Python 3 for new projects.
Yes. Variable
, variable
, and VARIABLE
are considered different identifiers.
Python source files use the .py
extension. Compiled bytecode files use .pyc
.
python script.py
You may need to use python3
instead of python
, depending on your system.
A collection of built-in modules and packages that provide functionality such as file I/O, system calls, web services, math operations, and more—without needing to install external libraries.
pip
is Python’s package installer. You can install libraries like this:
pip install package_name
Virtual environments allow you to isolate dependencies for different projects, preventing version conflicts:
python -m venv myenv
source myenv/bin/activate # On Unix/macOS
myenv\Scripts\activate # On Windows
An interpreter executes code line by line (like Python), while a compiler translates code into machine code before execution (like C++). Python’s interpreter makes it more flexible but often slower than compiled languages.
REPL stands for Read–Eval–Print Loop. It allows you to run Python commands one at a time interactively:
$ python
>>> print("Hello")