Python Chapter 2

Chapter 2 Python Comments

Comment woh chhoti note hoti hai jo coder apne liye likhta hai. Python ise padhta nahi, sirf insan padhta hai.

Comments kyun achay hote hain?

Syntax: # yeh comment hai

Logic samjhana

Comment batata hai ke next line ka kaam kya hai.

Debugging mein help

Temporary note likh kar ya line explain kar ke bug trace karna asaan hota hai.

Teamwork

Dusra banda code dekhe to foran samajh jaye ke flow kya hai.

Yahan dekh kar samjho

Comment ho ya na ho, Python sirf asli code chalata hai.

Code

# naam display karna hai
print('Ali')

Yeh lines chalti hain

  • print('Ali')

Output

Ali

Chhota test

Ab check karo ke comment aur code ka farq samajh aaya ya nahi.

Python mein comment kis symbol se start hota hai?

Comment wali line ka kya hota hai?

Kaunsi line comment hai?

Comment kyun likhte hain?

Comment chhoti si note hoti hai jo hume code samajhne me madad deti hai.

Logic samjhana

Comment batata hai ke next line ka kaam kya hai.

Debugging mein help

Temporary note likh kar ya line explain kar ke bug trace karna asaan hota hai.

Teamwork

Dusra banda code dekhe to foran samajh jaye ke flow kya hai.

Logic explain karna

# student ka total marks store karo
marks = 450
print(marks)

Comment sirf samjhata hai, run sirf niche wali lines hoti hain.

Debugging note

price = 1200
# discount baad mein apply hogi
print(price)

Aap comment mein apni yaad-dahani bhi likh saktay ho.

Team ke liye context

# yahan user se naam lena hai
name = input("Enter name: ")

Comment se next developer ko intent samajh aata hai.

More Topics

More Python Topics