VMware ESXi and vSphere Cluster Management

Python Overview: Uses, Features, and Getting Started with Python 3

Learn what Python is, why it is popular, where it is used, how Python 2 differs from Python 3, and how to begin with Python 3.

What Is Python?

Python is a high-level, general-purpose, interpreted programming language. A high-level language hides many low-level machine details and provides abstractions that are easier for people to use. A general-purpose language can create many categories of software instead of being limited to one specialized task.

Python code is executed by an interpreter, the program that reads and runs Python instructions. Python emphasizes readable syntax, developer productivity, and portability. You can use it to create web services, automation scripts, scientific programs, desktop applications, command-line tools, and many other types of software.

Python is not an application such as a spreadsheet or a database. It is a language for instructing a computer to create programs.

Why Python Is Approachable

Python is often recommended to beginners because its syntax is concise and designed to be readable. Readability is the ease with which people can understand source code. Python uses familiar words such as if, for, and import, along with relatively simple punctuation and structure.

For example, this is a complete Python program:

print("Hello, Python!")

The print() function displays text. The text between quotation marks is a string literal. Save the instruction in a file named hello.py, then run it with a Python 3 interpreter.

Python also includes a large standard library: modules supplied with Python for common tasks such as working with files, dates, text, network connections, and operating-system features. Built-in types and standard-library modules reduce repeated programming work.

Core Advantages of Python

Strength or considerationWhy it mattersTypical impact
Readable syntaxPeople can understand and review code more easily.Helpful for teaching, collaboration, maintenance, and debugging.
Rapid developmentConcise source code and built-in features allow ideas to be tested quickly.Useful for prototypes, scripts, and business applications.
Large ecosystemMany third-party packages, tutorials, communities, and learning resources are available.Common tasks often have existing tools instead of requiring everything to be built from scratch.
Cross-platform supportPython runs on Windows, macOS, Linux, and other systems.The same source code can often be used on multiple operating systems.
Runtime performancePython may be slower than a low-level compiled language for some CPU-bound work.Performance-sensitive systems may use another language, optimized libraries, or a hybrid design.
Application distributionUsers may need the correct interpreter, packages, and platform-specific packaging.Shipping a Python application can require additional tooling.

Python implementations are free and open source. Open source means that software source code is available under an open license, subject to that license's terms. Python is broadly available, has an international user community, and is relevant to many educational and professional roles.

These advantages explain Python's popularity, but they do not make it the best choice for every project. Language choice should consider project requirements, existing systems, performance needs, team skills, and ecosystem support.

Where Python Is Commonly Used

Application domainTypical tasksRepresentative Python tools or libraries
Web developmentBackend services, web APIs, request handling, and database-connected applications.Django, Flask, FastAPI
Data analysis and scienceNumerical work, data cleaning, statistics, visualization, and scientific research.NumPy, pandas, SciPy, Matplotlib
Automation and scriptingRenaming files, processing text, generating reports, and performing repetitive system tasks.pathlib, shutil, subprocess, and other standard-library modules
Machine learningPreparing data, training models, evaluating results, and deploying predictions.scikit-learn, PyTorch, TensorFlow
Desktop GUI applicationsWindows, forms, menus, and other graphical user interfaces.Tkinter, PyQt, PySide
Testing and DevOpsAutomated tests, build tasks, deployment helpers, monitoring utilities, and command-line tools.pytest, unittest, Ansible, and command-line packages

The appropriate library or framework depends on the domain and the project's requirements. Python itself provides the language, while libraries and frameworks add specialized capabilities.

Example: A Short Automation Task

This script lists text files in the current directory. It demonstrates a variable, a loop, and the standard-library pathlib module:

from pathlib import Path

folder = Path(".")
for file_path in folder.glob("*.txt"):
    print(file_path.name)

The script uses Path to work with file paths and loops over matching files. A real automation program could then read, rename, summarize, or move those files.

Portability and Execution Environments

Portability is the ability for code to run in multiple operating systems or environments with minimal changes. Python supports Windows, macOS, Linux, and other platforms. A simple script that uses only portable language features and standard-library modules can often run on all three major desktop operating systems when a compatible Python interpreter is installed.

Portability does not mean that every Python application works identically everywhere. Differences can come from:

  • Different Python versions or interpreter implementations.
  • Third-party packages that are not installed on the other computer.
  • Operating-system-specific file paths, commands, permissions, or graphical systems.
  • Packaging and deployment tools that produce different files for different platforms.

Portable source code and portable application distribution are separate concerns. A script may need little or no source-code change while still requiring platform-specific dependency installation or packaging.

Python's Origin and Stewardship

Guido van Rossum created Python. The language originated in the early 1990s as a project focused on making programming practical and readable. The early history should not be reduced to a misleading claim about one exact first release date.

Python is developed openly by contributors around the world. The Python Software Foundation and the broader Python community support the language's open development, distribution, documentation, and ecosystem.

Python 2 Versus Python 3

Python 2 and Python 3 were distinct major language lines. Python 3 changed some syntax and behavior, so it is not fully backward-compatible with Python 2. Backward compatibility describes whether newer software can run code written for an earlier version.

AspectPython 2Python 3
Support statusRetired and end-of-life.Current major language line, with individual releases supported according to their maintenance schedules.
Use for new projectsDo not select it for new learning or development.Use a currently supported Python 3 release.
CompatibilitySome code and behavior differ from Python 3.Not fully backward-compatible with Python 2.
Course recommendationAvoid tutorials and dependencies that target Python 2 unless migration work is specifically required.Ensure tutorials, packages, and the runtime target Python 3.

A small example of a difference is the printing syntax. Python 3 uses a function call:

print("Hello")

Older Python 2 material may show print "Hello". This is one reason a tutorial written for Python 2 can fail when copied into a Python 3 course. New learners should follow current Python 3 documentation and examples.

When Should You Choose Python?

Python is a strong fit when you want to:

  • Learn programming fundamentals with relatively readable syntax.
  • Automate repetitive tasks and process files or text.
  • Build web backends and APIs.
  • Work with data, numerical computation, visualization, or scientific programs.
  • Experiment quickly with a prototype.
  • Create general-purpose applications and developer tools.

Python may not be the ideal sole technology for every performance-critical or resource-constrained system. A low-level compiled language may provide better runtime performance for some CPU-bound tasks. Python applications can also require extra work to package the interpreter and dependencies for end users.

Evaluate the complete project rather than choosing a language by popularity alone. Consider required performance, target platforms, available libraries, integration with existing systems, team experience, maintenance, and deployment needs.

First Steps with Python 3

Before starting, you need basic computer skills such as creating folders, downloading software, and opening a terminal or command prompt. No prior programming experience is required.

Install and Verify Python

Install a currently supported Python 3 release for your operating system. After installation, open a new terminal and try the command appropriate for your system:

python --version
python3 --version
py --version

The correct command depends on the operating system and installation method. Use the command that reports a supported Python 3 release. The output should identify Python 3, not Python 2.

Try the Interactive Interpreter

The interactive interpreter, sometimes called a REPL, lets you enter Python instructions and see results immediately. Start it with one of these platform-appropriate commands:

python
python3
py

Confirm that the interpreter banner identifies Python 3, then try:

2 + 3
print("A quick experiment")

Exit with exit(), or use the platform's end-of-input shortcut.

Write and Run a Script

Create a file named hello.py containing:

message = "Hello from a Python script"
print(message)

Run the file from the folder containing it:

python hello.py
python3 hello.py
py hello.py

Use only the command that starts your Python 3 interpreter.

Use a Virtual Environment

A package is reusable Python code distributed for installation and use in projects. A virtual environment is an isolated Python environment for a project's interpreter packages. Virtual environments help prevent one project's dependencies from changing another project's environment.

Create one inside a project folder with:

python -m venv .venv
python3 -m venv .venv

On Windows, activate it with:

.venv\Scripts\activate

On macOS or Linux, activate it with:

source .venv/bin/activate

Use the command that matches your platform and interpreter. Detailed package installation and dependency management are useful next lessons.

Troubleshooting Common First Steps

“python” or “python3” Is Not Recognized

  • Python may not be installed.
  • The installation directory may not be available on PATH, the set of directories searched for commands.
  • Your operating system may use a different launcher command.

Install a supported Python 3 release, try python3 or py where appropriate, and reopen the terminal after installation. Then verify the version again.

A Tutorial Example Requires Python 2

The material may be retired, or it may rely on syntax or behavior that changed in Python 3. Prefer Python 3 documentation and tutorials. If you must maintain old code, update it using Python 2-to-Python 3 migration guidance rather than treating Python 2 as a modern learning choice.

A Script Works on One Computer but Not Another

  • Compare the Python versions used on both computers.
  • Check whether a required third-party package is missing.
  • Look for operating-system-specific paths or commands.
  • Use cross-platform path handling such as pathlib where practical.
  • Record project dependencies and use a virtual environment.

Installing a Package Affects Another Project

The package was probably installed into a shared interpreter environment. Create a separate virtual environment for each project, activate it before installing dependencies, and run the project while that environment is active.

Key Takeaways

  • Python is a high-level, general-purpose, interpreted programming language.
  • Its readable syntax, standard library, community, and ecosystem support learning and productive development.
  • Python is used in web development, data work, automation, artificial intelligence, desktop software, testing, DevOps, and command-line tools.
  • Python source code is often portable, but dependencies and application packaging may still be platform-specific.
  • Python 2 is end-of-life. New learners and projects should use a currently supported Python 3 release.
  • Begin by installing Python 3, verifying the interpreter, trying the interactive interpreter, running a small script, and using virtual environments for project dependencies.