Hey there! I'm Hariom Lohar, and this is your one-stop blog for Week 1 of our Python journey. Everything you need — videos, explanations, and practice — will live right here.
Got a doubt? Don't sit on it — ask away in our group 👇
💬 Join the WhatsApp Group (Learn Python)
🎬 Step 0: Before You Start
We're learning Python the way Harvard does it — using the famous CS50P course. Don't worry, we'll go slow and keep it simple!
First, watch this short intro (only 5 minutes, promise):
📅 Week 1: Functions & Variables
Now watch today's main lecture:
📺 CS50P – Lecture 0 – Functions, Variables
Once you've watched it, come back here — we'll break down the two big ideas from the video in the simplest way possible. 👇
🧠 What is a Variable?
Imagine you have a box, and you write a name on it — like age or name. Whatever you put inside that box, you can use later just by calling its name. That's exactly what a variable is!
age = 10
name = "Riya"
Here's what's happening:
ageis a box holding the number10nameis a box holding the word"Riya"
Want to see what's inside the box? Just print it:
print(age)
print(name)
Output:
10
Riya
🔄 Boxes can change!
A variable isn't stuck forever — you can put something new in the same box anytime:
age = 10
age = 11
print(age)
Output: 11 — because the box now holds the new value.
💡 Why bother with variables?
Because typing the same value again and again is boring (and error-prone!). Store it once, use it a hundred times:
score = 90
print(score)
print(score * 2)
print(score - 10)
⚙️ What is a Function?
Think of a function like a machine. You feed something into the machine, it does its job, and gives you a result back. You don't need to know how the machine works inside — you just use it!
You've actually already used one function without knowing it: print(). That's a built-in function — Python already made this machine for you.
print("Hello, World!")
But you can also build your own machine using the def keyword:
def greet():
print("Hello, welcome to Python!")
greet()
Output:
Hello, welcome to Python!
🎁 Functions can take input too!
Just like a coffee machine needs coffee beans as input, a function can take parameters:
def greet(name):
print("Hello, " + name + "!")
greet("Hariom")
greet("Riya")
Output:
Hello, Hariom!
Hello, Riya!
💡 Why bother with functions?
Because they let you reuse code instead of writing the same lines again and again. Write it once, call it whenever you need it!
❓ Questions You Might Have
Q: Do I need to tell Python what type a variable is (like int or string)?
No! Unlike some languages, Python figures out the type automatically based on what you store in it.
Q: Can I name a variable anything I want?
Almost — but a few rules apply: no spaces, can't start with a number, and no using Python's reserved words (like print or def) as a name.
Q: What's the difference between a variable and a function?
A variable stores something. A function does something (and can also give something back).
Q: Can a function work without any input?
Yes! Like our greet() example above — some functions need no parameters at all.
Q: What happens if I use a variable before giving it a value?
Python will throw an error — a box needs something inside it before you can look at it!
Q: Is print() the only built-in function?
Not at all — Python has many built-in functions like input(), len(), and type(). We'll meet more of these soon.
Q: Can a variable hold a function's result?
Yes! For example: result = greet("Hariom"). This is super common and very useful.
📓 Practice Time — Colab Notebook
We'll be practicing everything hands-on in a Google Colab notebook, where you can write and run real Python code — no installation needed!
🚧 Coming Soon — link will be added here shortly. Stay tuned!
✅ Quick Recap
- A variable is a labeled box that stores information
- A function is a reusable machine that performs a task
- Python figures out variable types automatically
- We can build our own functions using
def print()is a function Python already gives us for free
That's Week 1 done! 🎉 Great job making it this far. See you in Week 2!
💬 Still confused about something? Don't stay stuck — drop your question in the group:
Whatsapp Group (Learn Python)