Day 38 of 100 Days of Python | Instance vs Class Variables Today I learned the difference between instance variables and class variables in Python. Understanding this helps avoid confusion and bugs when working with Object-Oriented Programming (OOP). 🔹 Instance Variables • Belong to a specific object • Defined using self • Each object has its own copy 🔹 Class Variables • Belong to the class itself • Shared among all objects • Defined inside the class, outside methods 🧠 Easy Way to Understand Instance variable → Personal data Class variable → Shared data Example: • Your name → instance variable • College name → class variable (same for all students) 🔑 Mini Takeaway Instance variables are unique to each object, while class variables are shared by all objects. Learning Python step by step 🚀 Have you ever mixed these two and got confused? 🤔 #100DaysOfPython #PythonBasics #LearningInPublic #OOP #Freshers #InstanceVariables #ClassVariables #PythonDeveloper
Instance vs Class Variables in Python
More Relevant Posts
-
Day 49 of 100 Days of Python | Countdown Timer Program Today I built a countdown timer program in Python using loops and the time module. This exercise helped me understand how to work with time delays and format output in real-time, which is useful in many real-world applications. 🔹 What This Program Does • Takes time input in seconds • Converts seconds into hours : minutes : seconds • Updates the timer every second • Displays a message when time is up 🧠 Key Concepts Practiced • for loop with reverse range • Time conversion logic • String formatting • time.sleep() for delays • Real-time program execution 🔑 Mini Takeaway Small programs like timers help connect programming logic with real-world use cases. 💬 Where would you use a countdown timer-productivity apps or games?🤔 #Day49 #100DaysOfPython #PythonBasics #PythonPractice #Loops #LearningInPublic #Freshers
To view or add a comment, sign in
-
-
Day 46 of 100 Days of Python | simple calculator exercise. Today I practiced building a simple calculator using if, elif, and else statements in Python. Conditional statements allow a program to make decisions based on user input, which is a core concept in real-world applications. 🔹 Why if-elif-else Is Important • Controls the flow of a program • Handles multiple conditions • Widely used in validations and business logic 🧠Task: Build a calculator that: • Takes an operator (+ - * /) • Takes two numbers • Performs the operation based on the condition 🔑 Mini Takeaway if-elif-else helps programs choose the correct action based on conditions. 💬 Try solving it yourself before checking the solution 👇 Which operator logic did you find easiest? #Day46 #100DaysOfPython #PythonBasics #IfElse #PythonPractice #LearningInPublic #Freshers
To view or add a comment, sign in
-
-
Day 43 of 100 Days of Python | Polymorphism Today I learned about Polymorphism, one of the core principles of Object-Oriented Programming (OOP). Polymorphism means “many forms” — the same method name can behave differently depending on the object that calls it. 🔹 What Is Polymorphism? Polymorphism allows: • Same method name • Different implementations • Different behaviors 🔹 Why Polymorphism Is Useful • Makes code flexible • Improves scalability • Reduces code duplication • Supports dynamic behavior 🧠 Easy Way to Understand Think of a remote control 📺 The power button works on TV, AC, and fan - Same button, different actions. 🔑 Mini Takeaway Polymorphism allows the same interface to perform different actions based on the object. Learning Python step by step 🚀 Which OOP concept do you enjoy more - inheritance or polymorphism? 🤔 #100DaysOfPython #PythonBasics #LearningInPublic #OOP #Freshers #Polymorphism #PythonDeveloper
To view or add a comment, sign in
-
-
Day 47 of 100 Days of Python | Weight Converter Exercise Today I practiced conditional logic using if-elif-else by building a simple weight converter in Python. This exercise converts weight between Kilograms and Pounds based on user input. 🔹 What This Exercise Covers • Taking user input • Using conditional statements • Applying basic arithmetic operations • Formatting output using round() 🧠 Exercise Description Task: Build a program that: • Takes a weight value • Asks for the unit (K for Kilograms, L for Pounds) • Converts the weight accordingly • Handles invalid input gracefully 🔑 Mini Takeaway Small exercises like this help strengthen logic and input handling, which are essential Python fundamentals. 💬 What kind of beginner exercises helped you the most when learning Python? 🤔 #Day47 #100DaysOfPython #PythonBasics #IfElse #PythonPractice #LearningInPublic #Freshers
To view or add a comment, sign in
-
-
🚀 Building Strong Python Programming Foundations: Functions, Lists & Tuples 📌 Functions Functions help you write reusable and structured code by breaking logic into smaller blocks. Why functions matter: -Avoids code repetition -Improves readability -Makes programs easier to maintain 📌 Lists and Tuples Used to store multiple values in a single variable. -List → Mutable (can be changed) -Tuple → Immutable (cannot be changed) 📍 Where this is used: -Data analysis & data cleaning -Automation scripts -Backend development -Machine learning pipelines #Python #Functions #Lists #Tuples #ProgrammingBasics #LearningPython #Freshers #Coding #DataScience 🚀💻
To view or add a comment, sign in
-
-
👋 Welcome back! 📅 Python Learning – Day 9 (Python Operators) Today is about something you use in almost every program: operators. Operators are how Python compares values, does calculations, and makes decisions possible. Without operators, your code can store data, but it cannot really work with that data. They are small symbols, but they control the logic behind your program. 📘 In this lesson, I’ve explained: ➕ Arithmetic operators like `+`, `-`, `*`, `/` ⚖️ Comparison operators like `==`, `!=`, `<`, `>` 🔗 Logical operators like `and`, `or`, `not` Most beginner mistakes here come from misunderstanding comparisons, not from writing wrong code. Once operators are clear, conditions and logic start to make sense naturally. 🔗 Tutorial link is in the comments. ⏭️ Tomorrow: Day 10 — Python If...Else #Python #PythonLearning #LearnPython #PythonBeginners #PythonDevelopers #CollegeStudents #Freshers #CSStudents #CodingLife #ProgrammingBasics #PythonOperators #LogicBuilding #100DaysOfCode #TechCareers #codepractice #codepracticelearning
To view or add a comment, sign in
-
-
Today I started with the basics: Variables & Data Types. A variable is just a name that stores data in memory. age = 21 name = "Mythili" is_student = True Python automatically understands the type of data we store — no extra effort needed. This makes Python simple and beginner-friendly. Starting small, staying consistent Are you learning Python too? #Python #LearningPython #Freshers
To view or add a comment, sign in
-
Day 42 of 100 Days of Python | Multiple Inheritance Today I learned about Multiple Inheritance in Python. Multiple inheritance allows a class to inherit features from more than one parent class, enabling code reuse from multiple sources. 🔹 What Is Multiple Inheritance? A class can inherit methods and properties from two or more parent classes. 🔹 Why Multiple Inheritance Is Useful • Reuse logic from multiple classes • Combine behaviors • Reduce code duplication • Build flexible designs 🧠 Easy Way to Understand Think of it like this: Parent 1 → Feature A Parent 2 → Feature B Child → Feature A + Feature B ⚠️ Important Note Multiple inheritance can cause confusion if parent classes have methods with the same name. Python solves this using MRO (Method Resolution Order). 🔑 Mini Takeaway Multiple inheritance allows a class to combine features from multiple parent classes—but should be used carefully. Learning Python step by step 🚀 Do you prefer simple inheritance or multiple inheritance? 🤔 #100DaysOfPython #PythonBasics #LearningInPublic #OOP #Freshers #MultipleInheritance #PythonDeveloper
To view or add a comment, sign in
-
-
👋 Welcome back! 📅 Python Learning – Day 8 (Python Input and Output) 👉👉Today we move from writing static code to writing interactive code. So far, Python has been doing what you tell it to do. Now, it starts reacting to what the user gives it. This is where input and output come in. Input lets your program receive data. Output lets your program show results. This is the step where programs start to feel alive instead of fixed. 📘 In this lesson, I’ve covered: ⌨️ How to take input from the user 🖨️ How to display output clearly ⚠️ Common input and output mistakes beginners make Many beginner bugs happen because input is treated as a number when it’s actually text. Understanding this early saves a lot of confusion later. When you control input and output properly, you control how your program communicates. 🔗 Tutorial link is in the comments. ⏭️ Tomorrow: Day 9 — Python Operators #Python #PythonLearning #LearnPython #PythonBeginners #PythonDevelopers #CollegeStudents #Freshers #CSStudents #CodingLife #ProgrammingBasics #UserInput #InputOutput #100DaysOfCode #TechCareers #codepractice #codepracticelearning
To view or add a comment, sign in
-
-
Day 54 of 100 Days of Python | Product of Array Except Self (Leetcode) Today I solved the Product of Array Except Self problem and explored two different approaches - starting with a brute-force solution and then optimizing it using prefix and suffix products. 🧠 Problem Overview Given an array of integers, return an array such that each element at index i is the product of all elements except itself without using division. 🔹 Approach 1: Brute Force (Nested Loops) For each index, multiply all other elements except itself. • Time: O(n²) • Space: O(n) - Easy to understand - Not efficient for large inputs 🔹 Approach 2: Optimized (Prefix + Suffix Products) • First pass --> store product of elements to the left • Second pass --> multiply with product of elements to the right • Time: O(n) • Space: O(1) - Efficient - No division used - Interview-preferred solution 🔑 Mini Takeaway Optimized solutions often come from breaking a problem into smaller logical passes. 💬 Which part did you find more interesting - prefix pass or suffix pass? 🤔 #Day54 #100DaysOfPython #LeetCode #PythonPractice #DSA #Arrays #LearningInPublic #Freshers
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