← Back to Python Course | Chapter 1: Basics | Lesson 1 of 14

Python Introduction

Python is like a friendly language you use to give a computer instructions. It reads almost like plain English, so it is a great first language to learn.

What is Python?

Python is a high-level, general-purpose programming language prized for readable, near-English syntax that lets you express ideas in fewer lines than languages like C++ or Java.

It runs on an interpreter rather than compiling to machine code ahead of time, which is why it's often the first language recommended to beginners.

Example: What is Python?

python
# Python: readable, near-English syntax
name = "Alex"
print("Hello,", name)

Why Learn Python?

Python's clean syntax and huge ecosystem of ready-made libraries mean you spend more time solving your actual problem and less time fighting the language itself.

That combination of gentle learning curve and serious production power is why it stays one of the most in-demand skills for both beginners and professional engineers.

Example: Why Learn Python?

python
# Import the statistics module for calculations like mean()
import statistics
scores = [88, 92, 79, 95]  # list of four test scores
print(statistics.mean(scores))  # compute and print the average score

How Python Works

Because Python is interpreted, the interpreter reads and executes your source file one statement at a time instead of compiling the whole program into a binary first.

This makes the edit-run-fix loop very fast for experimentation, though it also means Python programs typically run slower than compiled languages for raw number-crunching.

Example: How Python Works

python
print("Step 1")
print("Step 2")
print("Step 3")
# Each line runs immediately, in order -- no separate compile step

Applications of Python

Python powers an unusually wide range of real work: Django and Flask for web backends, NumPy/Pandas/scikit-learn for data science and machine learning, requests and BeautifulSoup for scraping and automation, and boto3 or similar SDKs for cloud infrastructure scripting.

Example: Applications of Python

python
# Django/Flask: web backends
# NumPy, Pandas, scikit-learn: data science & ML
# requests, BeautifulSoup: scraping & automation
# boto3: cloud infrastructure scripting
print("Python powers web, data science, scraping, and cloud tools")

Benefits of Python

Python ships official installers for Windows, macOS, and Linux, so the same script generally runs unmodified across platforms.

Combined with one of the largest open-source communities of any language, that portability means answers, packages, and tutorials for almost any problem are just a search away.

Example: Benefits of Python

python
import platform  # module to get info about the operating system
print("Running on:", platform.system())  # print the current OS name
print("Same script runs on Windows, macOS, and Linux")  # message emphasizing cross-platform support
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
Common Mistakes
  1. Typing python and expecting an interactive result from a .py file: running python alone opens the REPL, while a script needs python hello.py.
  2. Calling the language 'compiled only' or assuming Python 2 code such as print "hi" still works, when Python 3 requires print("hi").
  3. Installing Python but never ticking 'Add python.exe to PATH' on Windows, so the python command is not found in the terminal.

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.