Skip to main content

Module 0: Before Python

Before we start coding in Python, it is important to understand some basic concepts. In this module, we will learn what software is, how computers understand code, and why we use Python.


0.1 What is Software?

Software is a set of instructions or programs that tell a computer what to do.

  • Real World Examples:

    • Apps on your phone like WhatsApp, YouTube, and Instagram are software.
    • Programs on your computer like VS Code and Google Chrome are also software.
  • Software vs Hardware:

    • Hardware: The physical parts of a computer that you can touch (Keyboard, Mouse, Monitor, RAM, CPU).
    • Software: The digital code or apps that run on the hardware. You cannot touch software.

Analogy: If the hardware is a phone's body, the software is the phone's operating system and apps. One cannot work without the other.


0.2 What is Programming?

Programming is the process of creating step-by-step instructions to solve a problem using a computer.

  • Real World Example (Making Tea):
    1. Pour milk and water into a pot.
    2. Turn on the stove and place the pot on it.
    3. Add tea powder and sugar.
    4. Wait for it to boil, filter it, and pour it into a cup.

This step-by-step method is exactly how programming works. We write clear steps for the computer to follow.


0.3 What is Coding?

Coding is writing those step-by-step instructions in a language that the computer can understand (a Programming Language).

  • Coding vs Programming:
    • Programming: Planning how to solve the problem and designing the logic (the big picture).
    • Coding: Translating that logic into lines of code (writing the actual lines).

Summary: Coding is just one part of programming. Programming is about thinking, and coding is about writing.


0.4 What is a Programming Language?

A Programming Language is a special language used by humans to talk to computers and give them instructions.

  • Human Language vs Machine Language:
    • Computers do not understand English or Telugu.
    • Computers only understand 0 and 1 (Binary Code / Machine Language).
    • Since writing code in 0s and 1s is very difficult for humans, we use languages like Python, Java, and C++ to write code easily. The computer then translates it.

0.5 How Computers Understand Code?

A computer translates the English-like code we write (High-Level Language) into its own language (Machine Code - 0s and 1s).

  • CPU Basics: The CPU (Central Processing Unit) is the brain of the computer. It can only understand electrical signals: On (1) and Off (0).
  • Execution Flow:
High-Level Code (Python) ──> Translator (Interpreter) ──> Machine Code (0s & 1s) ──> CPU Executes

0.6 Compiler vs Interpreter

A translator converts our code into machine code. There are two main types of translators:

FeatureCompilerInterpreter
How it worksTranslates the entire code all at once.Translates the code line-by-line.
SpeedFast execution because translation is done once.Slower execution because it translates as it runs.
ErrorsShows all errors only after reading the whole file.Stops running immediately when it finds the first error.
ExamplesC, C++, JavaPython, JavaScript

Python Execution Process:

Python is an Interpreted Language. When you run a Python program, it first compiles the code into Bytecode and then uses the Python Virtual Machine (PVM) to interpret and run it line-by-line.


0.7 Why Python?

Python is the most popular programming language in the world today. Here is why:

  1. Simple Syntax: Python code is very clean and looks like simple English.
  2. Beginner Friendly: It is easy to learn for absolute beginners.
  3. Versatile: You can use Python for web development, automation scripts, and data analysis.
  4. Why AI Uses Python: Artificial Intelligence (AI) and Machine Learning (ML) require a lot of data processing. Python has excellent libraries (like NumPy, Pandas, TensorFlow) that make this very easy. This is why AI developers prefer Python.

:::tip Golden Tip Learning Python is the best starting point for a career in AI, Machine Learning, and automation! :::