संदेश

Puzzles लेबल वाली पोस्ट दिखाई जा रही हैं

Python OOP Encapsulation Explained 🔐 | Private, Protected & Public Variables

चित्र
✅ Object-Oriented Programming Part-2: Encapsulation ✍️ 🔐 What is Encapsulation Encapsulation = protecting data inside a class. Hide internal data Control how data is accessed Prevent direct modification Real-life example. ATM machine You cannot access bank balance directly You use functions (deposit, withdraw) 🔒 Why Encapsulation is important Data security Controlled access Prevent accidental changes Cleaner code structure 📚 Public Variables (Normal Variables) Accessible from anywhere. class Student: def __init__(self): self.name = "Deepak" s = Student() print (s.name) Problem → anyone can change data. s.name = "Ankit" 🔒 Protected Variables (_variable) Single underscore → “internal use” warning. class Student: def __init__(self): self._marks = 85 s = Student() pr...

Hard Maths Puzzle Challenge 2026 – दिमाग हिला देने वाले 20 गणित प्रश्न (उत्तर सहित)

चित्र
🧠 20 सुपर हार्ड माइंड ब्लोइंग पहेलियाँ (विकल्प सहित) निर्देश: पहले उत्तर मत देखना 😉 अंत में Answer Key दी गई है। 1️⃣ एक कमरे में 3 बल्ब और बाहर 3 स्विच हैं। आप कमरे में सिर्फ एक बार जा सकते हैं। कैसे पहचानेंगे कौन-सा स्विच किस बल्ब का है? A. अनुमान लगाकर B. बटन दबाकर भाग्य आज़माएँ C. एक स्विच कुछ देर ऑन रखकर बंद करें, दूसरा ऑन रखें D. दरवाज़ा बार-बार खोलें 2️⃣ 8 गेंदों में से 1 हल्की है। केवल 2 बार तराजू से कैसे पहचानेंगे? A. एक-एक करके तौलें B. 4-4 में बाँटकर तौलें C. 3-3 तौलें, फिर 2 तौलें D. सभी साथ में तौलें 3️⃣ ऐसी कौन-सी चीज़ है जिसे जितना साझा करें, उतनी कम हो जाती है? A. पैसा B. राज़ C. समय D. ज्ञान 4️⃣ एक आदमी बारिश में 24वीं मंज़िल तक लिफ्ट से जाता है, धूप में 12वीं तक। क्यों? A. लिफ्ट खराब रहती है B. वह जल्दी में होता है C. वह बौना है D. बिजली बचाता है 5️⃣ 17 भेड़ों में से 9 को छोड़कर बाकी मर गईं। कितनी बचीं?                             Hard Maths Puzzle in Hindi A. 8...