🌱 Phase 1 · Foundations 🟢 Beginner MODULE 01

Introduction to Python

⏱️ 25 min read
📖 Theory + Code
🧩 5 Quiz Questions
🏗️ 1 Challenge
Your progress in Phase 117%
🎯 What you'll learn: What Python is, where it's used, its history, how to install it on your computer, and how to write and run your very first Python program — even if you have zero experience.

What is Python?

Python is a high-level, general-purpose programming language — which basically means it's a language you can use to tell a computer what to do, but in a way that feels almost like writing English sentences rather than complex machine code.

When you write Python, the computer reads your instructions and executes them. You can use Python to build websites, automate tasks, analyze data, create AI systems, write games, and much more — all with the same language.

💡
Think of Python as a universal remote
Just like a universal remote can control any TV, Python can control almost any kind of software system — from a tiny script that renames your files to a full machine learning model running inside Google.
📅
Created: 1991
By Guido van Rossum. Named after Monty Python, the British comedy show.
🏆
#1 Language
The most popular programming language in the world since 2021 (TIOBE Index).
📦
500,000+ Libraries
Python has the largest ecosystem of add-on packages of any language.
💰
High Paying
Average Python developer salary: $110,000/yr in the US. Growing globally.

Why Learn Python?

There are hundreds of programming languages. Python has become the most popular one for very specific reasons — it's designed to be human-readable and versatile.

Python's superpower: Readability
Python uses indentation (spaces) to define structure instead of curly braces {} like other languages. This forces clean, readable code and makes it easy to understand even months later.

Compare: Hello World in 3 languages

Java vs C++ vs Python
COMPARISON
// Java (verbose, lots of boilerplate)
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

// C++ (complex syntax)
#include <iostream>
int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

# Python (simple, clean, readable)
print("Hello, World!")

Python lets you do the same thing in 1 line instead of 5–8 lines. This is why beginners learn Python 3× faster than other languages — and why companies love it too (less code = fewer bugs).

Where Python is used in the real world

🤖
AI & Machine Learning
ChatGPT, Google AI, Tesla Autopilot
🌐
Web Development
Instagram, Pinterest, Spotify backend
📊
Data Science
NASA, WHO, financial analysis
🤖
Automation
Bots, scripts, file management
🔐
Cybersecurity
Penetration testing, network tools
🎮
Game Dev
Pygame, indie games, prototypes

Companies that rely on Python

🔍 Google 📸 Instagram 🎵 Spotify 🚀 NASA 🎬 Netflix 🔴 Reddit 📦 Dropbox 🤖 OpenAI 🚗 Uber 📌 Pinterest

A Brief History of Python

Python didn't appear out of nowhere. Understanding its history helps you appreciate why it's designed the way it is.

1
1989 — The Idea 💡
Guido van Rossum, a Dutch programmer, started working on Python during Christmas holidays as a hobby project. He wanted a language that was easier to use than C, but more powerful than shell scripts.
2
1991 — Python 1.0 Released 🎉
The first public version was released. It included functions, exception handling, and the core data types. The name was inspired by Guido's love of the British comedy show "Monty Python's Flying Circus."
3
2000 — Python 2.0 🔧
Major upgrade with list comprehensions, garbage collection, and Unicode support. Python 2 ran the world for over a decade and millions of projects were built on it.
4
2008 — Python 3.0 ⚡
A major rewrite that fixed fundamental design flaws. Python 3 is NOT backward compatible with Python 2. Today, Python 3 is the standard — and what we teach in this course.
5
2021–Present — #1 Language 🏆
Python became the most popular language globally. It powers AI, data science, web backends, and automation at major companies worldwide. Currently at version 3.12.
🎭
Fun Fact: Python's Easter Egg
Open Python and type import this and press Enter. You'll see "The Zen of Python" — 19 guiding principles for writing good Python code, written by Tim Peters. Try it after you install Python!

Installing Python

Before writing code, you need Python installed on your computer. It takes about 5 minutes. Follow the steps for your operating system.

⚠️
Always install Python 3
Never install Python 2 — it was officially retired in 2020. Always download Python 3.x (currently 3.12) from the official website: python.org

🪟 Windows Installation

1
Download the installer
Go to python.org/downloads → Click "Download Python 3.12.x" — the big yellow button.
2
Run the installer
Open the downloaded file. IMPORTANT: Check the box that says "Add Python to PATH" before clicking Install Now. This is essential.
3
Verify the installation
Open Command Prompt (press Win + R, type cmd, press Enter). Type python --version and press Enter. You should see Python 3.12.x.

🍎 Mac Installation

1
Download the installer
Go to python.org/downloads → Click the macOS installer.
2
Run & install
Open the .pkg file, follow the steps, and complete the installation. Python will be added automatically.
3
Verify in Terminal
Open Terminal (press Cmd + Space, type "Terminal"). Type python3 --version → you should see the version number.

🐧 Linux Installation

Terminal — Ubuntu/Debian
BASH
# Update package list
sudo apt update

# Install Python 3
sudo apt install python3 python3-pip

# Verify installation
python3 --version

💻 Setting Up VS Code (Recommended Editor)

A code editor makes writing Python much easier. We recommend Visual Studio Code — it's free, fast, and has amazing Python support.

1
Download VS Code
Go to code.visualstudio.com and download VS Code for your OS.
2
Install the Python extension
Open VS Code → Click the Extensions icon (4 squares on left) → Search "Python" → Install the one by Microsoft.
3
Select your Python interpreter
Press Ctrl+Shift+P → Type "Python: Select Interpreter" → Choose Python 3.12.

Your First Python Program

It's time to write actual code. Let's start with the most famous program in the world — "Hello, World!" — and then go a few steps further.

Method 1 — Run Python Interactively (REPL)

The Python REPL (Read-Evaluate-Print Loop) lets you type code and see results immediately — perfect for testing.

Terminal / Command Prompt
TERMINAL
# Open terminal and type:
python   # Windows
python3  # Mac / Linux

# You'll see something like:
Python 3.12.0 (main, Oct 3 2023)
>>> # This is the REPL prompt. Type code here!

>>> print("Hello, World!")
Hello, World!

>>> 2 + 3
5

>>> print("My name is Python!")
My name is Python!

Method 2 — Write a Python File (.py)

For real programs, you write code in a file with the .py extension and run it from the terminal. This is how all real Python projects work.

hello.py — Your First Python File
PYTHON
# This is your first Python program!
# Lines starting with # are comments — Python ignores them

print("Hello, World!")
print("Welcome to Python!")
print("I am learning to code on BitWithBite.")
🚀
How to run your .py file
Open terminal in the same folder as your file. Type python hello.py (Windows) or python3 hello.py (Mac/Linux) and press Enter. You'll see the output printed below!

Going Further — Your Name Program

Let's write a slightly more interesting program that asks for your name and greets you personally.

greeting.py — An Interactive Program
PYTHON
# greeting.py
# An interactive greeting program

print("=============================")
print("   Welcome to Python! 🐍")
print("=============================")

name = input("What is your name? ")
print(f"Hello, {name}! Great to meet you!")
print(f"Welcome to Python, {name}. Let's build something amazing!")

Don't worry if you don't understand every part yet — you'll learn input() in Module 5 and f-strings in Module 3. For now, just focus on running the code and seeing the output. That's the most important thing at this stage.

📝
Understanding print()
print() is a built-in Python function that displays text on the screen. Whatever you put inside the parentheses (in quotes) gets printed. This is the most used function in all of Python — you'll use it thousands of times.

Python 2 vs Python 3

You might encounter old tutorials or books that use Python 2. Here's what you need to know about the differences:

Key Differences
COMPARISON
# Python 2 (OLD — do NOT use)
print "Hello"         # print is a statement
5 / 2  # gives 2       # integer division by default
unicode("hello")      # separate unicode type

# Python 3 (CURRENT — always use this)
print("Hello")         # print is a function
5 / 2  # gives 2.5     # true division by default
"hello"               # all strings are unicode

The rule is simple: always use Python 3. Python 2 reached end-of-life in January 2020 and no longer receives security updates. Every lesson in this course uses Python 3.

The Zen of Python

Python has a philosophy — a set of guiding principles that explain why Python looks and works the way it does. You can read it by running import this in Python. Here are the most important ones for beginners:

📜
Python's Guiding Principles
Beautiful is better than ugly. Write code that looks clean.
Simple is better than complex. Don't overcomplicate solutions.
Readability counts. Code is read more often than it is written.
Errors should never pass silently. Always handle errors explicitly.
There should be one obvious way to do it. Python prefers one clear solution.

Lesson Summary

Let's recap everything you learned in this lesson:

Python is a high-level, general-purpose programming language designed for readability and simplicity.
Python is used in AI, web development, data science, automation, cybersecurity, and more.
Python was created by Guido van Rossum in 1991 and is now the world's #1 programming language.
Always use Python 3. Download from python.org, add to PATH on Windows, verify with python --version.
print() is the most basic Python function — it displays text on the screen.
You can run Python interactively (REPL) or write code in a .py file and run it from terminal.
Lines starting with # are comments — Python ignores them. Use them to explain your code.
🧩 Knowledge Check — Lesson 1
Answer all 5 questions to test your understanding. Instant feedback on every answer.
1. Who created Python?
2. Which version of Python should you always use today?
3. What does the print() function do in Python?
4. What symbol is used to write a comment in Python?
5. On Windows, what important option must you check during Python installation?
💪
Coding Challenge — Lesson 1
Apply what you learned · Beginner Level

Now it's your turn to write real code. Complete the challenge below in VS Code or any Python environment.

Challenge: Build Your Python ID Card 🪪

Write a Python program called mycard.py that prints a nicely formatted "ID Card" about yourself. Your output should look like this (with your own details):

================================
       MY PYTHON ID CARD 🐍
================================
Name : Ahmed Khan
Country : Pakistan
Language : Python 3
Goal : Become an AI Engineer
Platform : BitWithBite.com
================================
Hello World! My Python journey starts TODAY!
================================

Rules: Use only print() statements. Add at least one comment at the top of your file. Use your real name and goal.
💡 Show hints if you're stuck
  • Use print("text here") for each line
  • For the separator line, use print("=" * 32) — Python repeats the character 32 times
  • Start your file with a comment: # My Python ID Card Program
  • Run the file with python mycard.py in terminal
🎉

Lesson 1 Complete!

You've taken your first step into the world of Python. 9 more phases await you — and it only gets more exciting from here.

Module 01 of 50+ Phase 1 — Python Foundations