Today you'll master the terminal, install Python, and write real programs that make your computer do what you tell it. By the end, you'll be a person who can code.
Throughout this lab, we'll use PowerShell as our terminal. We'll store all our course files in H:\Pooja. Make sure you can see the H: drive on your computer before starting.
Let's refresh what we learned last time and learn a few more useful commands. Remember: the terminal is just a text-based way to talk to your computer.
The terminal is a text window where you type commands. You type a command, press Enter, and the computer does what you asked. Today we'll use PowerShell — Windows' modern terminal. It works the same way as Command Prompt but has more features.
powershell — you'll see "Windows PowerShell" appear in the search results.The PS at the start means you're in PowerShell. The path after it (C:\Users\YourName) is the folder you're currently "standing in."
Type each of these commands and press Enter after each one. Observe the result before moving to the next.
Here are some new commands. Try each one.
Every file has a full address called a path. Today we'll navigate between two different drives (C: and H:) and become confident moving around your computer from the terminal.
Think of drives as separate buildings. C: is the main building where Windows lives. H: is another building (maybe a network drive or a second hard disk your school provides). Each building has its own rooms (folders) and papers (files). To get to a room in a different building, you first need to go to that building.
pwd — "Where am I right now?" (Print Working Directory)
cd foldername — Go into a folder
cd .. — Go up one folder (to the parent)
cd \ — Go to the root of the current drive
cd H:\Pooja — Jump directly to a specific path (any drive)
H: — Switch to the H: drive (just type the drive letter and colon)
H:\Pooja in your prompt before continuing. If the Pooja folder doesn't exist yet, we'll create it in the next module.Starting from H:\Pooja, follow these navigation instructions exactly. After each step, type pwd to confirm you're in the right place.
You are at PS C:\Users\YourName\Desktop>. You type cd .. and press Enter. What will the new prompt show?
cd .. goes up one folder. From Desktop, one folder up is YourName. So the prompt becomes PS C:\Users\YourName>.You are at PS H:\>. You type cd Pooja then cd .. then cd ... Where are you now?
cd Pooja takes you to H:\Pooja. First cd .. takes you back to H:\. Second cd .. tries to go above H:\ but you're already at the root — so you stay at H:\. You can't go above the root of a drive.You type cd H:\Pooja from PS C:\Windows\System32>. What does the prompt show?
cd a full path (starting with a drive letter like H:\), it jumps directly there — no matter where you currently are. This is called an absolute path.Which of these is a file path (not a folder path)?
.py). H:\Pooja\hello.py points to a specific file. The others point to folders.Last time you created files and folders by right-clicking. Today you'll do it the programmer way — from the terminal. This is faster and the way you'll do it throughout the course.
cd into it.day2 folder and go inside it.day2 inside Pooja.You just created an empty file called practice.txt from the terminal. Check File Explorer — it's there!
My name is [your name]. I am learning Python today!Get-Content is the PowerShell command to read a file's contents and print them in the terminal. You edited a file in Notepad and confirmed the changes from the terminal — both tools see the same file.
You can also put text into a file without even opening Notepad:
Before installing Python, let's first check if it's already on this computer. There's a simple way to check from the terminal.
The easiest way to check if a program is installed and ready to use is to try running it. If the terminal says "not recognized" — it's either not installed or not set up properly. If it shows a version number or opens the program — it's installed and working.
python --version and press Enter.python3 --version — some installations use python3 instead of python.Let's practice this skill by checking for other programs. Try each:
The pattern is always the same: type the program name followed by --version. If you get a version number, it's installed. If you get an error, it's not (or it's not in the PATH — we'll cover that soon).
You type python --version and see Python 3.11.5. What does this mean?
If Python is not installed (or you want a fresh install), follow these steps. We'll install it from the terminal — the programmer way. Since you're not an admin on this computer, we'll install it just for your user account.
If python --version already shows Python 3.10 or higher — skip this module and go to Module 6. No need to install again!
We will: (1) Download the Python installer from the internet — this copies a file to your computer. (2) Run the installer — this sets up Python on your computer so you can use it. We'll use PowerShell commands for both steps. The installation will be "per-user" which means it doesn't need admin permission.
We'll use a PowerShell command to download the installer file from the official Python website.
Invoke-WebRequest command carefully (or copy it from the screen if your instructor provides it). Press Enter.ls python-installer.exe to make sure the file exists. You should see the file with a large size (about 25 million bytes).You just downloaded a file using the terminal instead of a browser. The file python-installer.exe is now sitting in H:\Pooja\day2 — you can see it in File Explorer too.
Now we run the installer. The special flags tell it to install just for you (no admin needed) and to add Python to the PATH automatically.
cd H:\Pooja\day2The PATH (the list of locations where the terminal looks for programs) is loaded when the terminal starts. Since we just added Python to the PATH during installation, we need to restart the terminal so it picks up this change. The old terminal window still has the old PATH.
If you see a version number — congratulations, Python is installed! If you still see an error, move on to Module 6 where we'll troubleshoot it.
Let's understand why typing python works — and what to do if it doesn't.
When you type python, here's what happens behind the scenes:
1. The terminal reads your command: python
2. It asks: "Where is a program called 'python'?"
3. It looks through a list of folders called the PATH
4. It finds python.exe in one of those folders
5. It runs that program
The PATH is just a setting — a list of folder locations stored in your computer. When the terminal needs to find a program, it checks each folder in the PATH list, one by one, until it finds the program. That's it — nothing magical.
See that? Python was installed to a folder deep inside your user account. The terminal knows to look there because that folder was added to the PATH during installation.
Python. That's the line that was added during installation..exe in any of them, it runs it.If you get an error like "not recognized," it just means the PATH setting doesn't include Python's folder. The fix is to add Python's folder to the PATH. Here's how:
Skip this if python --version already works. Only do this if you get the "not recognized" error.
Don't be intimidated by that long command. All it does is add Python's folder to the saved list of PATH folders. You only need to do this once. After this, python will work every time you open PowerShell.
What is the PATH?
When you type python --version, you're not just running Python — you're running Python and telling it something. That --version part is called an argument.
Think of going to a coffee shop. You say: "Coffee, large, no sugar."
coffee = the program (what you want)
large = an argument (how you want it)
no sugar = another argument (more instructions)
In the terminal: python --version
python = the program
--version = the argument ("just tell me your version, don't do anything else")
The same program can do completely different things depending on what arguments you give it:
python) does completely different things depending on the arguments.python without arguments and see >>>, you're inside Python's interactive mode. Type exit() to get back to PowerShell.Every command you've been using has been: program name followed by arguments. cd H:\Pooja = program cd, argument H:\Pooja. You've been using arguments all along!
This is it. The moment you become a programmer. You're about to write a Python program and run it.
H:\Pooja\day2:Look at that! Your computer just did what you told it to do. You wrote an instruction in Python (print("Hello, World!")) and the computer followed it. hello.py is the argument — it tells Python which file to read and run.
Every programmer in history started exactly here — with "Hello, World!" You are now officially someone who can write and run code.
notepad hello.pyThe cycle is: Edit → Save → Run. This is the cycle you'll follow thousands of times as a programmer. You change the code, save the file, and run it again to see the result.
Let's make the program interactive — it will ask for your name and respond to it.
notepad hello.pyThe program waited for you to type something! input() pauses the program and waits for the user to type something and press Enter. Then it stores whatever they typed and uses it later. You just made the computer listen to you and respond.
Every program you will ever write — from a simple greeting to a video game — does one or more of these three things.
Input = getting data (from the keyboard, a file, the internet, etc.)
Process = doing something with that data (math, decisions, sorting, combining, etc.)
Output = showing the result (on screen, saving to a file, sending over the internet, etc.)
Your "Hello World" was just Output. Your name program was Input → Process → Output. Let's see more examples.
Create a new file called about_me.py and paste this:
python about_me.pyprint() statements as you want. Each one prints one line. The program runs them top to bottom, one at a time.Create a new file called birth_year.py:
python birth_year.py20) and press Enter.Let's see what Python can do. For each program below: create the file, paste the code, run it, and try to guess how it works before reading the explanation. No stress — just have fun.
python countdown.pytime.sleep(1) probably do? What does range(10, 0, -1) probably mean?What does time.sleep(1) do?
time.sleep(1) tells Python to wait 1 second before continuing. That's why the numbers appear one per second. If you changed it to time.sleep(3), it would wait 3 seconds between each number.python compliment.py12 for the length. You'll get a random 12-character password.You now know how to create a Python file and run it. That means you can use AI tools (like ChatGPT or Claude) to generate Python code for anything you want — a quiz game, a unit converter, a to-do list — then paste it into a file and run it on your computer. You don't need to understand every line to make it work. This is a genuine superpower. In the coming classes, you'll also learn to write your own complex programs from scratch.
Let's look at a program that's a bit more complex. You won't understand every single word yet — and that's completely fine. The goal is to see the big picture of how a real program works. We'll cover every detail starting from the next lecture.
5 for the choice. What happens? (The "else" catches invalid choices.)0 as the second number, choice 4). What happens?Let's read through the code together. You don't need to memorize anything — just build a feeling for how it flows.
Lines that start with # are comments. Python completely ignores them. They're notes for humans reading the code. # Ask the user for two numbers is just a note to help you understand what the next line does.
first_number = input("Enter the first number : ")
This creates a variable called first_number. A variable is like a labeled box — it has a name (first_number) and holds a value (whatever the user types). The = sign means "store this value in this box." After this line, whenever you write first_number, Python knows you mean whatever the user typed.
num1 = float(first_number)
When you type 50, Python actually receives it as the text "50" — not the number 50. Text and numbers are different things in programming. float() converts text into an actual number so we can do math with it. Without this, "50" + "8" would give "508" (joining text) instead of 58 (adding numbers).
if choice == "1": means "if the user typed 1, do this."
elif choice == "2": means "otherwise, if they typed 2, do this instead."
else: means "if none of the above matched, do this."
This is how programs make decisions. It's like a flowchart: check the first condition → if no, check the second → if no, check the third → if nothing matches, do the default thing. The == means "is equal to" (two equals signs, not one).
This program follows the exact Input → Process → Output pattern:
INPUT: Three input() calls get two numbers and an operation choice from the user.
PROCESS: float() converts text to numbers. if/elif/else picks the right math operation. The calculation is done.
OUTPUT: print() shows the result.
Every program you'll ever write follows this same pattern — just with more complexity in each section.
If the user enters 10, 3, and 2 (for subtract), what will the result be?
10.0 - 3.0 = 7.0.What does float() do in this program?
input() always gives us text (like the text "50"), even if the user types a number. float() converts that text into an actual number (50.0) so Python can do math with it.The user enters 6, 2, and 7. What will the "Operation" line say?
7 doesn't match "1", "2", "3", or "4", so the else block runs. That sets operation_name to "Unknown" and result to "Error".Check off everything you accomplished today. Look at how much you've done!
You went from opening a terminal to writing and running real Python programs. You made a calculator. You generated passwords. You taught your computer to count down and launch a rocket. Starting next class, we'll learn Python from the ground up — variables, types, conditions, loops — and you'll understand exactly why everything in today's programs works the way it does.
In the next lecture we'll start learning Python properly — from the very basics. We'll cover variables, data types, operators, and how Python reads your code line by line. All the pieces from today's calculator (like float(), if/elif/else, ==) will be explained in full detail. You already have a head start — you've seen them in action!