`print()`, comments, code structure
1. print() — talking to the human
Deriving the behaviour from first principles
We don't guess what print() does — we reason it out by trying the smallest cases.
print("Hello") # 1 argument: a string
print(42) # 1 argument: a number
print("Sum:", 2 + 3) # 2 arguments
print() # 0 argumentsWhy does print("Sum:", 2 + 3) show Sum: 5?
- Step 1: Python evaluates each argument first.
"Sum:"stays"Sum:";2 + 3becomes5. Why this step? Python always computes the value before handing it to a function. - Step 2:
printjoins multiple arguments with a space by default and writes them. - Step 3:
printadds a newline (\n) at the end automatically. Why? So eachprintlands on its own line — the most common need.
2. Comments — notes for humans
# This whole line is ignored.
print("Hi") # everything after # on THIS line is ignored
radius = 5 # store the radius in cm
area = 3.14159 * radius ** 2 # πr²3. Code structure — how Python reads a file

Active recall — flashcards
What kind of Python construct is print?
What are the values inside print()'s parentheses called?
What does print add after its arguments by default?
end="\n").What does print put between multiple arguments by default?
sep=" ").What is the return value of print()?
None (its real job is the side effect of showing text).How do you stop print from going to a new line?
end="" (or any string you want).What symbol starts a single-line comment?
#.Does Python execute comments?
Why does print(Hello) (no quotes) fail but print("Hello") works?
Hello is treated as a variable name → NameError; quotes make it a literal string.In what order do statements run by default?
What does print("A","B",sep="-") output?
A-B.A good comment explains the ___, not the obvious ___.
Recall Feynman: explain to a 12-year-old (hidden)
Imagine the computer is a super-fast but blind helper. It does maths and remembers things in its head, but you can't see any of it. print() is like telling the helper "say that out loud so I can hear it!" — that's the only way you find out what it knows. A comment (#) is like a sticky note you write next to your instructions: the helper reads right past it, it's only for you to remember why you wrote each step. And the helper always follows your instructions in order, from the top of the page to the bottom, never skipping ahead.
Connections
- Variables and Assignment —
printdisplays what variables hold. - Strings and Quotes — why text needs
" ". - f-strings and String Formatting — nicer ways to build text for
print. - Functions, Arguments, and Return Values —
printis a function;sep/endare keyword arguments. - Indentation and Code Blocks — structure rule used by
if/for. - None and Truthiness — why
printreturnsNone.
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Dekho, programming ki shuruaat mein do cheezein sabse zaroori hain. Pehli — computer ke andar sab kuch chhupa rehta hai, hume dikhta nahi. To jab tak hum print() nahi likhte, hume pata hi nahi chalta ki andar kya ho raha hai. print() ek function hai jo parentheses ke andar di gayi values ko screen par dikha deta hai. Yaad rakhna: jo bhi values ho, Python pehle unhe evaluate karta hai (jaise 2 + 3 pehle 5 ban jaata hai), phir dikhata hai.
Do chhupe hue default samajh lo: sep matlab arguments ke beech kya aayega (by default ek space), aur end matlab last argument ke baad kya aayega (by default newline \n, isliye har print nayi line par jaata hai). Agar tum end="" doge to next print usi line par aa jaayega — yeh trick bahut kaam aati hai. Ek important baat: print ka return value None hota hai, value print nahi return karta — uska kaam sirf dikhana hai. Isliye x = print(5) karoge to x mein 5 nahi, None aayega.
Doosri cheez — comments. # ke baad jo bhi likho, Python use bilkul ignore karta hai. Yeh sirf insaano ke liye notes hote hain, taaki 6 mahine baad bhi tumhe yaad rahe ki yeh line kyu likhi thi. Tip: comment mein kyun likho, kya nahi — kyunki "kya" to code khud bata raha hota hai.
Aakhir mein code structure: Python file ko upar se neeche, ek-ek line padhta hai, recipe ki tarah. Isliye agar line B mein tum name use kar rahe ho, to line A mein name pehle banni chahiye — warna error. Bas yeh teen baatein — print karna, comment lagana, aur top-to-bottom flow — har bade program ki neenv hain.