Day 17 of my Python Full Stack journey. ✅ Today's topic: The 3 types of methods in OOP. Most beginners only know one. Here's all three explained simply. Here's what I typed today: class Student: school = "Acharya Institute" # class variable def __init__(self, name, marks): self.name = name # instance variable self.marks = marks # Instance method — works with one object def result(self): return f"{self.name}: {'Pass' if self.marks >= 50 else 'Fail'}" # Class method — works with the class itself @classmethod def school_name(cls): return f"School: {cls.school}" # Static method — independent, no self or cls @staticmethod def passing_marks(): return "Passing marks: 50" s1 = Student("Punith", 88) print(s1.result()) # instance method print(Student.school_name()) # class method print(Student.passing_marks()) # static method Simple rule: → Instance method — needs object data (use self) → Class method — needs class data (use cls) → Static method — needs neither. Just a helper function. Did you know all 3 types of methods before reading this? #PythonFullStack #Day17 #OOP #BuildingInPublic #100DaysOfCode #Bangalore
Python OOP Methods Explained
More Relevant Posts
-
Day 12 of my Python Full Stack journey. ✅ Today's topic: Functions Deep Dive — the parts most beginners skip. *args and **kwargs. Looked confusing at first. Made complete sense after 45 minutes. Here's what I typed today: # Default arguments def greet(name, role="Developer"): print(f"Hey {name}, future {role}!") # *args — multiple positional arguments def add_all(*numbers): return sum(numbers) print(add_all(1, 2, 3, 4)) # 10 # **kwargs — multiple keyword arguments def show_info(**details): for key, value in details.items(): print(f"{key}: {value}") show_info(name="Punith", city="Bangalore", stack="Python") Why this matters for Django: → Django views use *args and **kwargs everywhere → Every class based view passes **kwargs automatically → Understanding this now saves hours of confusion later Pushed to GitHub immediately. Lesson learned. ✅ #PythonFullStack #Day12 #BuildingInPublic #100DaysOfCode #Bangalore
To view or add a comment, sign in
-
-
I built my first real Python project today. 🐍 A fully functional Contact Book — runs in the terminal, no frameworks, no tutorials to copy from. What it does: → ➕ Add multiple contacts at once → 📋 View all saved contacts → ❌ Delete contacts by number → 🔁 Keeps running until you choose to exit What I used to build it: → Dictionary — to store name + phone pairs → While loop — to keep the app running → Functions — to avoid repeating code → Enumerate — to number contacts cleanly 3 weeks ago I didn't know what a dictionary was. Today I built an app with one. That's what consistent learning looks like. 💪 #Python #LearningInPublic #DataAnalytics #PythonProject #BBA #buildinpublic
To view or add a comment, sign in
-
🐍 Python Cheat Sheet – Quick Reference for Beginners & Developers Master the essentials of Python in one glance! 🚀 🔹 Variables & Data Types x = 10 (int) | name = "John" (str) | pi = 3.14 (float) | is_active = True (bool) 🔹 Operators Arithmetic: + - * / % Comparison: == != > < Logical: and or not 🔹 Control Statements if x > 5: print("Greater") else: print("Smaller") 🔹 Loops for i in range(5): print(i) while x > 0: x -= 1 🔹 Functions def greet(name): return f"Hello {name}" 🔹 Lists / Tuples / Sets list = [1,2,3] tuple = (1,2,3) set = {1,2,3} 🔹 Dictionary student = {"name":"John","age":21} 🔹 File Handling with open("file.txt","r") as f: data = f.read() 🔹 Exception Handling try: x = int("abc") except: print("Error") 🔹 OOP Basics class Car: def __init__(self, name): self.name = name 💡 Save this post for quick revision & share with learners! #Python #Coding #Programming #Developers #Learning #Tech #CheatSheet
To view or add a comment, sign in
-
-
🐍 Python Cheat Sheet – Quick Reference for Beginners & Developers Master the essentials of Python in one glance! 🚀 🔹 Variables & Data Types x = 10 (int) | name = "John" (str) | pi = 3.14 (float) | is_active = True (bool) 🔹 Operators Arithmetic: + - * / % Comparison: == != > < Logical: and or not 🔹 Control Statements if x > 5: print("Greater") else: print("Smaller") 🔹 Loops for i in range(5): print(i) while x > 0: x -= 1 🔹 Functions def greet(name): return f"Hello {name}" 🔹 Lists / Tuples / Sets list = [1,2,3] tuple = (1,2,3) set = {1,2,3} 🔹 Dictionary student = {"name":"John","age":21} 🔹 File Handling with open("file.txt","r") as f: data = f.read() 🔹 Exception Handling try: x = int("abc") except: print("Error") 🔹 OOP Basics class Car: def __init__(self, name): self.name = name 💡 Save this post for quick revision & share with learners! #Python #Coding #Programming #Developers #Learning #Tech #CheatSheet
To view or add a comment, sign in
-
-
🚀 Python Series – Day 16: Modules & Packages (Write Clean & Reusable Code!) Yesterday, we learned Exception Handling ⚠️ Today, let’s learn how to avoid writing messy code and reuse it like a pro 📦 🧠 First, Think Like This 👉 Imagine you write 100 lines of code in one file 😵 👉 It becomes confusing, hard to manage, and difficult to reuse 💡 Solution? → Modules & Packages 🔹 What is a Module? 👉 A module = one Python file (.py) 👉 It contains functions, variables, or classes 📌 In simple words: “Module = Separate file for better organization” 💻 Example (Real Understanding) 👉 Create a file: my_module.py def greet(name): return f"Hello {name}" 👉 Now use it in another file: import my_module print(my_module.greet("Mustaqeem")) ⚡ Built-in Module Example Python already gives ready modules: import math print(math.sqrt(25)) 👉 Output → 5.0 🔹 What is a Package? 👉 A package = folder of multiple modules 📌 In simple words: “Package = Collection of related modules” 📦 Example Structure my_package/ math_utils.py string_utils.py 👉 This keeps your project clean and structured 🎯 Why This is Important? ✔️ Avoids messy code ✔️ Makes projects easy to manage ✔️ Helps reuse code again & again ✔️ Used in real-world projects & companies ⚠️ Pro Tip (Very Important) 👉 Don’t write everything in one file ❌ 👉 Break your code into modules ✅ 🔥 One-Line Summary 👉 Module = File 👉 Package = Folder of files 📌 Tomorrow: OOP in Python (Classes & Objects – Game Changer!) Follow me to learn Python from basics to advanced 🚀 #Python #Coding #Programming #DataScience #LearnPython #100DaysOfCode #Tech #MustaqeemSiddiqui
To view or add a comment, sign in
-
-
Today was one of those Python lessons that felt less like learning code and more like learning how to read its warnings properly. 🐍 Day 15 of my #30DaysOfPython journey was all about errors, and honestly, this topic matters because every developer runs into them. When Python code fails, it gives feedback that tells us where the issue is and what kind of problem it is. Learning to understand those messages makes debugging a lot faster. Today I went through the common ones: 1. SyntaxError — when the code is written incorrectly 2. NameError — when a variable has not been defined 3. IndexError — when an index goes out of range 4. ModuleNotFoundError — when a module cannot be found 5. AttributeError — when an attribute does not exist 6. KeyError — when the wrong key is used in a dictionary 7. TypeError — when an operation is applied to the wrong data type 8. ImportError — when something is imported incorrectly 9. ValueError — when the value is valid in type, but not in meaning 10. ZeroDivisionError — when a number is divided by zero What stood out to me today was how errors are not just problems — they are clues. Once you stop panicking and start reading them properly, debugging becomes a lot less intimidating. One more day, one more topic, one more step toward writing code with less guessing and more understanding. Which error has annoyed you the most while coding so far? #Python #LearnPython #CodingJourney #30DaysOfPython #Programming #DeveloperJourney
To view or add a comment, sign in
-
🚫 Most beginners use Python dictionaries WRONG… …and they don’t even realize it. When I first learned dictionaries, I thought: “It’s just key → value… easy.” But then I hit a bug that made NO sense. The truth is most people skip: A dictionary is like a smart storage system: Looks simple, right? But the REAL rule is: Keys must be IMMUTABLE (unchangeable) You CAN use: Strings → "name" Integers → 1 Floats → 1.5 Tuples → (1, 2) ❌ You CANNOT use: Lists ❌ Sets ❌ Dictionaries ❌ ⚠️ Why? Because Python needs keys that stay stable. If keys change… your data breaks. 🧠 Simple memory trick: 👉 “Keys = Locked 🔒 (immutable) 👉 Values = Flexible 🔄 (anything)” Once I understood this… Everything clicked: ✔ Cleaner code ✔ Fewer bugs ✔ Better logic If you’re learning Python, don’t just memorize… Understand WHY things work. That’s where real growth starts #Python #Coding #Programming #LearnPython #DataAnalytics #BeginnerProgrammer #TechSkills #100DaysOfCode #Developers #AI #CareerGrowth
To view or add a comment, sign in
-
-
Day 7 of my Python Full Stack journey. ✅ Today's topic: Dictionaries — the most important data structure in Python. A dictionary stores data as key-value pairs. Think of it like a real dictionary — word (key) and its meaning (value). Here's what I typed today: student = { "name": "Punith", "age": 24, "course": "Python Full Stack" } # Access print(student["name"]) # Punith # Add / Update student["city"] = "Bangalore" # Loop through for key, value in student.items(): print(f"{key}: {value}") Why this matters for Django: Every Django model, every API response, every JSON data — all dictionary-like. If you understand dictionaries, Django will make sense. 60 minutes done. Pushed to GitHub. Day 8 tomorrow. One week and 2 days in. Still showing up. 💪 #PythonFullStack #Day7 #Dictionaries #BuildingInPublic #100DaysOfCode #Bangalore
To view or add a comment, sign in
-
-
🚀 New Blog Published: Python Dictionaries – Store Data in Key-Value Pairs 🐍 As I continue learning Python, I’ve reached one of the most useful and widely used data structures: 👉 Dictionaries Unlike lists that use indexes, dictionaries help us store data in a much smarter way using key-value pairs. In my latest beginner-friendly blog, I explained: ✅ What are Python Dictionaries ✅ How to create and access key-value pairs ✅ Adding, updating, and removing data ✅ Looping through dictionaries ✅ Real-life student record example ✅ Practice questions for beginners This concept is especially important because dictionaries are used in: 💻 APIs 🌐 Web development 🗄️ Databases 🤖 Machine learning I’m documenting my Python journey step by step through CodingNotesHub to make concepts easier for other beginners as well. 📘 Read the full blog here: 🔗 ___________________________ (Link will be added in the comments 👇) Small concepts today → strong foundations tomorrow 🚀 #Python #PythonForBeginners #Programming #PythonDictionary #LearningInPublic #CodingJourney #EngineeringStudents #CodingNotesHub
To view or add a comment, sign in
-
🚀 Day 2: Understanding Variables & Data Types in Python In Python, variables are used to store data values simple, yet powerful. 👉 You don’t need to declare a variable type explicitly. Python automatically understands it! Example: x = 10 # Integer name = "Ali" # String price = 99.9 # Float 🔹 Common Data Types in Python: ✔ Integer (int) → 10, -5 ✔ Float → 3.14, 99.9 ✔ String → "Hello" ✔ Boolean → True / False 💡 Why it matters? Understanding data types is the foundation of programming. Every application — whether it's web development or AI — relies on how data is stored and processed. 📌 Key Tip: Use meaningful variable names to make your code clean and readable. I’m continuing my Python journey step by step. Stay tuned for more! #Python #Coding #Programming #Learning #Developers #Backend #FullStack #Django
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development