Today you'll set up your coding workspace in VS Code, learn how Python stores and uses data, and — most importantly — learn how to read errors and fix your code when things go wrong.
Last time we wrote code in Notepad. That works, but it's like writing an essay with a crayon — possible, but there are better tools. Today we'll use Visual Studio Code (VS Code), the tool most professional programmers use.
VS Code is a code editor — like Notepad, but built specifically for programmers. It looks like Notepad (you type text, you save files), but it has special features that make coding much easier. The biggest one is syntax highlighting — it colors different parts of your code so you can read it more easily. Keywords in one color, text in another, numbers in a third. This coloring is purely for your eyes — the computer doesn't care about colors, but it makes a huge difference for humans reading the code.
Notepad is like a plain notebook — you can write anything, but there's no help. VS Code is like a smart notebook that highlights important words, tells you when you misspell something, and has colored tabs to organize your pages. The writing is the same — but the experience is much better.
One of the best things about VS Code is extensions. An extension is like an app for your phone. Your phone can make calls by default, but you install apps to add more features (camera filters, games, maps). Similarly, VS Code can edit text by default, but you install extensions to add more features — like special support for Python, or for other programming languages. By itself, VS Code doesn't have special support for any particular programming language. You add that support by installing the right extension.
Visual Studio Code (or just code), and click on it.Hello from VS Code! in it. You can close this without saving (click the X on the tab, click "Don't Save").Let's add Python support to VS Code by installing an extension.
Python.You just installed an extension! This adds Python-specific features: syntax highlighting (coloring Python code), error detection, and more. The Python extension doesn't change what your code does — it just makes it easier for you to read and write Python.
Python and select it. This tells VS Code to treat this file as Python."Pooja" and "Hello," are in one color (they're text strings). 20 is in a different color (it's a number). print is in yet another color (it's a built-in function). This is syntax highlighting.What does syntax highlighting do?
What is a VS Code extension?
Let's create our Day 3 project folder in VS Code and learn to manage files, folders, and the integrated terminal — all from one window.
H:\Pooja and click Select Folder.Pooja folder and inside it, the day2 folder with all the files you made last time.day3 and press Enter. You just created a new folder!day3 folder to select it. Then click the icon that looks like a file with a plus sign (next to the folder icon).test.py and press Enter. A new empty file opens in the editor. The .py extension tells VS Code this is a Python file, so syntax highlighting will work automatically.day3: click the new-file icon, name it delete_me.py.delete_me.py in the Explorer → click Rename → change the name to temporary.py → press Enter.temporary.py → click Delete → confirm. The file is gone.day3 → New Folder → name it practice. Then right-click on practice → Delete to remove it.Everything you do in VS Code's Explorer panel is real — the files and folders exist on your H: drive. You can verify by opening File Explorer and navigating to H:\Pooja\day3.
This terminal is exactly the same as the PowerShell window you opened separately in Day 2. All the commands work the same way — pwd, ls, cd, python, etc. The only difference is that it's built into VS Code, so you don't have to switch between two separate windows. You write code in the top half and run it in the bottom half. Very convenient!
pwd and press Enter. It should show H:\Pooja (or wherever your folder is).cd day3ls to see your files. You should see test.py.Look at the top-right area of the terminal panel. You'll see a dropdown or text that says "powershell" (or similar). Click the small dropdown arrow (˅) next to it.
dir and press Enter. It shows files — just like ls in PowerShell.There are different types of terminals (shells): PowerShell and Command Prompt on Windows, Bash and Zsh on Mac/Linux. They all do the same job (let you type commands), but the commands are slightly different. For example, to list files: ls (PowerShell/Mac/Linux), dir (Command Prompt). Once you learn one, learning others is easy — the concepts are identical, only the command names change. We'll use PowerShell for this course.
What is the VS Code integrated terminal?
Let's make sure everything works end-to-end: write Python code in VS Code, run it in the terminal, see the output — all in one window.
test.py in the Explorer panel (the file you created in Module 2). It opens in the editor.day3 folder. If not, type cd H:\Pooja\day3.python test.py and press Enter.This is now your workflow: write code in the editor (top) → save → run in the terminal (bottom) → see output. This is how professional programmers work every day.
When you run python test.py, Python reads the file from disk. If you changed code in the editor but didn't press Ctrl + S, Python will run the old saved version, not what you see on screen. Always save first! Look for the dot (●) on the tab — if it's there, you have unsaved changes.
This is the foundation of everything in programming. A variable is how your program remembers things.
Imagine you have labeled boxes on a shelf. One box is labeled age and inside it you put a slip of paper that says 20. Another box is labeled name and inside it is "Pooja". You can look inside any box to see what's there, change what's inside, or use the contents to do something. That's exactly what a variable is — a named box that stores a value.
To create a variable, you write: name = "Pooja". This is called assignment. The = sign does NOT mean "equals" like in math. It means: "take the value on the right side and store it in the box named on the left side." Think of = as an arrow pointing left: name ← "Pooja".
Create a new file: in the Explorer, right-click day3 → New File → name it variables.py. Type this code:
python variables.pyNotice: print(name) doesn't print the word "name" — it prints what's inside the variable name, which is "Pooja". The variable is the box, print opens the box and shows the contents.
10, -3, 0, 20265.4, 3.14, -0.5, 100.0"Hello", "Pooja", "123" (yes, "123" in quotes is text, NOT a number!)
Create update.py and type this:
python update.pyscore = score + 5. This means: "take the current value of score (25), add 5 to it, and store the result (30) back into score." The right side is calculated first, then stored into the left side.Create operators.py:
Create copy_var.py:
copy after we change original?copy = original copies the value at that moment. After that, they're independent. Changing original later doesn't change copy.Create strings.py:
Important: the + operator does different things depending on the data type. With numbers, it adds. With strings, it joins (concatenates). 5 + 3 gives 8. "5" + "3" gives "53".
What does x = x + 3 mean?
x + 3) is calculated first using x's current value. Then the result is stored back into x. If x was 10, after this line x becomes 13.What does print("5" + "3") output?
"5" and "3" are strings (they have quotes), not numbers. The + operator joins strings together: "5" + "3" → "53".Fill in the blanks so this code prints My age is 20:
age = 20 — Store the number 20 in the variable age.print("My age is", age) — Print the text followed by the value inside age.Fill in the blanks so that result contains 15:
result = x + y — Python calculates 10 + 5 and stores 15 into result.This is the most important skill you'll learn today. Errors happen to every programmer — beginners and experts with 20 years of experience. The difference is knowing how to read the error message and find the problem. Python actually tells you exactly what went wrong and on which line — you just need to know where to look.
Debugging means finding and fixing errors (called "bugs") in your code. The word comes from the early days of computing when an actual moth got stuck inside a computer and caused problems. Every single programmer in the world writes code with bugs. It's not a sign of being bad — it's a normal part of writing code. What matters is learning to fix them.
When Python finds an error, it shows you a message called a traceback. It has 3 key pieces of information:
1. Which file — the name of the file with the problem
2. Which line number — the exact line where Python got confused
3. What kind of error — what went wrong (the last line of the traceback)
Create bug1.py with this intentionally broken code:
Save and run: python bug1.py
File "H:\Pooja\day3\bug1.py" — it's in bug1.pyline 2 — the problem is on line 2print(mesage) — this is what Python tried to runNameError: name 'mesage' is not defined — Python doesn't know any variable called mesageDid you mean: 'message'? — we misspelled "message"!
mesage instead of message (missing an 's').mesage to message on line 2. Save and run again. It works!Create bug2.py:
country = "India"Create bug3.py:
"I am ") and an integer (age which is 20) with +. You can only + strings with other strings.message = "I am " + str(age) + " years old". The str() function converts a number into text.Create bug4.py with this code. There's a bug. Don't try to spot the bug by reading the code — run it first and use the traceback to find it.
"Total cost:" and total inside print(). The fix: print("Total cost:", total).Every time you get an error:
1. DON'T PANIC — errors are normal.
2. Read the last line of the traceback — it tells you the type of error.
3. Find the line number — go to that line in VS Code.
4. Look carefully at that line — the problem is there (or very close by).
5. Fix, save, run again.
Python automatically figures out the type of data — you don't have to tell it. But understanding types is crucial because certain operations only work with certain types.
In some languages, you have to say "this is a number" or "this is text" explicitly. In Python, you just write the value and Python figures it out:
x = 10 → Python sees a whole number → type is int.
y = 3.14 → Python sees a decimal → type is float.
z = "hello" → Python sees quotes → type is str.
You can always check the type using type().
Create types.py:
Look at d: the value "100" is a string (text), not a number — because it has quotes around it. 100 (no quotes) would be an int. Quotes make all the difference!
Create type_mix.py:
# print("age: " + 20) (remove the # at the start). Save and run. Read the error.#) and uncomment the other line to see that error too.You can convert values between types:
str(42) → converts the number 42 to the text "42"
int("42") → converts the text "42" to the number 42
float("3.14") → converts the text "3.14" to the number 3.14
int(3.9) → converts float to int (drops the decimal) → 3
Remember from Day 2: input() always gives a string. To do math with user input, you must convert it: int(input("Enter a number: "))
What is the type of "3.14" (with quotes)?
"3.14" is text. 3.14 (no quotes) is a float.What does int(7.9) return?
int() drops everything after the decimal point — it does NOT round. int(7.9) gives 7, not 8.Values in Python aren't just passive data — they come with built-in actions you can perform on them. These actions are called methods.
Think of a phone. A phone is an object. It can do things: make a call, send a text, take a photo. Those are its methods — actions the phone can perform. Similarly, a Python string can do things: make all letters uppercase, replace a word, count how many times a letter appears. You call a method using a dot: phone.take_photo() → "hello".upper().
Create methods.py:
The pattern is always: variable.method(). The dot (.) connects the variable to the action. Some methods need extra information inside the parentheses (like .replace("old", "new")), some don't (like .upper()).
Create num_methods.py:
abs(), round(), max(), min() are built-in functions (not methods). You write abs(x) not x.abs(). The difference isn't important now — just know they exist.What does "hello world".replace("world", "python") return?
.replace("world", "python") finds "world" in the string and swaps it with "python", giving "hello python".Time to put everything together. There are three types of exercises: Fill-in (complete the missing part), Debug (find and fix the error), and Write (write from scratch). Create a new file for each exercise.
Complete the code so it prints Hi, Pooja!
name — The blank should be the variable name which holds "Pooja". Concatenation joins them: "Hi, " + "Pooja" + "!" → "Hi, Pooja!"Complete the code so it prints the area of a rectangle (width × height):
area = width * height — This calculates 12 * 5 and stores 60 in area.The variable user_input is a string. Complete the code to convert it to a number and add 10:
int — int(user_input) converts the string "25" to the integer 25. Then 25 + 10 = 35.Complete the code so it prints PYTHON IS FUN:
upper — text.upper() converts all characters to uppercase.For each exercise: create the file, run it, read the traceback, find the line, fix the bug. Only then check the answer.
Username (capital U) is NOT the same as username (lowercase u). Fix: change Username to username on line 2."Total: " is a string and total is a float. You can't + them. Fix: print("Total: " + str(total)) or simpler: print("Total:", total).) at the end of line 3. Fix: print("Name:", name). Python sees line 4 and gets confused because line 3 wasn't finished.Hint: Enter 10 and 20. Does it show 30 or something else?
1020 instead of 30. input() returns strings, so "10" + "20" = "1020" (concatenation, not addition). Fix: num1 = int(input("Enter a number: ")) and same for num2.Hint: There are two bugs. Fix the first, run again, then fix the second.
price is a string "75000" (it has quotes!). You can't subtract a number from a string. Fix: change line 2 to price = 75000 (remove quotes).Product (capital P) should be product (lowercase p). Python is case-sensitive."She said ". Fix: use single quotes outside: sentence = 'She said "hello" to me', or escape the inner quotes: sentence = "She said \"hello\" to me".Write a program in ex_w1.py that:
celsius with the value 37fahrenheit = (celsius * 9/5) + 3237 °C = 98.6 °Fcelsius = 37fahrenheit = (celsius * 9/5) + 32print(celsius, "°C =", fahrenheit, "°F")Write a program in ex_w2.py that:
bio variable that concatenates them into one sentence like "My name is Pooja, I am 20 years old, from Mumbai." (Hint: you'll need str() for the age)bio in uppercase using a string methodname = "Pooja"age = 20city = "Mumbai"bio = "My name is " + name + ", I am " + str(age) + " years old, from " + city + "."print(bio.upper())Write a program in ex_w3.py that:
sentence with the value "I am learning Python and it is exciting"len())"i" appears (use .count())"Python" replaced by "programming"sentence = "I am learning Python and it is exciting"print("Length:", len(sentence))print("Count of 'i':", sentence.count("i"))print(sentence.replace("Python", "programming")).upper() (all lowercase), not .Upper(). Fix: print(text.upper())..upper() is a string method — it only works on strings, not on integers. score is 95 (an int). It doesn't make sense to "uppercase" a number. Fix depends on intent: if you want to print the number, just use print(score). If you want it as text, print(str(score)).This code runs without errors but gives the wrong answer. Expected output: Average: 20.0
a + b + c / 3 means 10 + 20 + (30/3) = 10 + 20 + 10 = 40.0. Fix: add parentheses: average = (a + b + c) / 3.Expected output: Final balance: 1200
balance + withdrawal but a withdrawal should subtract. Fix: change line 5 to balance = balance - withdrawal. Then: 1000 + 500 - 300 = 1200.You set up a professional coding workspace, learned how Python stores data, and — most importantly — you learned how to read errors and debug code. That last skill alone puts you ahead of most beginners. Next time, we'll learn about conditions (if/elif/else), loops, and start building more complex programs.