🟢 Day 1 — Thinking Like a Computer (Foundations)
1️⃣ Why Are We Learning This?
Imagine you are talking to a very obedient but very dumb assistant.
It never understands meaning It only follows exact instructions, step by step That assistant is a computer.
💡 Programming = learning how to give clear, exact, unambiguous instructions
Python is just the language we use to talk to it.
2️⃣ How a Computer Thinks (Very Important)
A computer:
Executes one line at a time Example (read carefully):
👉 Output will be 20
Because the latest instruction wins.
🧠 A computer does not remember history.
It only knows the current value.
3️⃣ Variables — Storing Information
Real-world analogy
Think of a labeled box.
Value = what is inside the box Python example
name = "Amit"
age = 22
print(name)
print(age)
Important Rules
Variable names should describe the data Python decides the type automatically You don’t declare types like other languages 4️⃣ Data Types (Only What We Need Today)→ i love my wife
Numbers
x = 10 # integer
price = 99.5 # float
Text (String)
Boolean (True / False)
🧠 Think of types as different kinds of boxes
5️⃣ Taking Input from User
So far, you are giving values.
Now let the user give values.
name = input("Enter your name: ")
print(name)
Important Truth (Critical for beginners)
❗ input() always gives text, even if user types a number.
age = input("Enter age: ")
print(type(age)) # this is string, not number
Converting to number
age = int(input("Enter age: "))
6️⃣ Making Decisions — if / else
Real life example:
If traffic light is red → stop
Else → go
Python works the same way.
age = int(input("Enter age: "))
if age >= 18:
print("Adult")
else:
print("Minor")
How computer evaluates this:
Check condition (age >= 18) If True → run first block If False → run else block 🧠 Computer does not know what “adult” means.
It only checks true or false.
7️⃣ Indentation — Python’s Superpower
Python uses spaces, not brackets.
❌ Wrong
if age >= 18:
print("Adult")
✅ Correct
if age >= 18:
print("Adult")
🧠 Indentation tells Python which code belongs together
8️⃣ Common Beginner Mistakes (Read Carefully)
Forgetting to convert input to number Assuming computer “understands intention” Example mistake:
Correct:
9️⃣ Practice Questions (Do These Seriously)
Do not jump to code immediately.
Think first. Write steps on paper.
Q1
Print "Hello, Python" on the screen.
Q2
Store your name and age in variables and print them.
Q3
Take a number from user and print whether it is positive or negative.
Q4
Take a number and print whether it is even or odd.
Q5
Take two numbers and print the larger one.
Q6
Take age as input and print:
"Teen" if age between 13–19 Q7 (Thinking Question)
What happens if the user enters "abc" instead of a number?
Why does the program crash?
(No fixing yet. Just observe.)
🔑 HINTS (Read Only If Stuck)
Use % operator to check even/odd if, elif, else are mutually exclusive Convert input using int() Comparison operators: >, <, >=, <=, == Think in true / false, not English meaning 🔟 What You Should Be Able to Do Now
By end of Day 1, you should:
Understand how computer executes code Make decisions using conditions Predict output before running code 🧠 Reflection (VERY IMPORTANT)
Answer in words, not code:
Why does computer need exact instructions? Why is input always a string? What happens if indentation is wrong? How does computer decide which block to run? ⭐ Golden Rule from Day 1
The computer is never wrong.
Your instructions are.