004. Python code me Comments

Prathmesh Mayekar
0

Namaste dosto! Aaj hum Python ke Comments ke baare mein baat karenge. Is chapter mein hum dekhenge ki Python mein comments kya hote hain aur unka istemal kaise hota hai.


Comments, code mein notes ya explanations dena ke liye use kiye jaate hain. Python mein comments "#" symbol se start hote hain aur uss line ke baad ka text Python interpreter ignore karta hai.


Example:

# Hinglish mein comment 
 print("Namaste duniya!") #Yeh ek simple print statement hai. 
 # Aage wali line comment hai 
 # print("Mera naam Rahul hai.")

Comments ka istemal code ko samajhne mein madad karte hain. Aap apne code mein comments likh kar aapne logic aur steps ko dusre developers ke saath share kar sakte hain.


Kuch aur examples dekhte hain:


# Variable ko define karte hain 
 
 name = "Shyam" 

 # Age calculate karte hain 
age = 25 
 # Output display karte hain 
 print("Mera naam hai:", name) 
 print("Meri umra hai:", age, "saal.")


Is example mein, humne code mein comments ka istemal kiya hai taaki dusre developers ko pata chale ki har line mein kya ho raha hai.


Python mein comments ka istemal aapke code ko organized, readable aur maintainable banata hai. Aapko comments ka sahi tarike se istemal karna hai taki aapke code ko samajhna aasan ho. Aage aur bhi Python ke concepts sikhne ke liye maze karte rahiye! Happy coding! 🐍😄

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Accept !