🚀 Day 1/30 – Introduction to Python Data Types Today I started revising the basics of Python Data Types as part of my #30DaysOfPython challenge. Understanding data types is very important because every value in Python belongs to a specific type. 🔹 Main Data Types in Python: 1️⃣ int – Integer numbers Example: x = 10 2️⃣ float – Decimal numbers y = 69.9 3️⃣ str – Sequence of characters (written inside quotes) name = "Vyshu " 4️⃣ bool – Boolean values True False (True acts like 1, False acts like 0) 5️⃣ complex – Numbers with real and imaginary parts z = 2 + 3j ---------------------------------------------------------------------- 🔁 Mutable vs Immutable ✔ Mutable → Can be changed Examples: list, set, dict ✔ Immutable → Cannot be changed after creation Examples: int, str, float, bool, complex, tuple ---------------------------------------------------------------------- 💡 What I Learned Today: Python supports different types of data. Some data types can be modified (mutable), and some cannot (immutable). Understanding data types helps in writing better programs. Looking forward to learning more tomorrow 🚀 #Python #PythonBasics #100DaysOfCode #LearningJourney #CVCorpInstitute #30DaysOfPython
Python Data Types: Integers, Floats, Strings & More
More Relevant Posts
-
Variables in python: 💡 What if I told you… In Python, a “variable” doesn’t actually store data? Yes! Let that sink in for a second. When I first started learning Python, I thought: num = 100 means the variable(num) stores 100. But that’s not entirely true. 🔎 Here’s what really happens: 🔹 Variables A variable is just a name that references an object in memory. It points to data — it doesn’t physically store it. When you reassign: - num = 100 - num = 200 You’re not “changing the box.” You’re making the name point to a new object. That small understanding changes how you think about Python. 🔒 What About Constants? Python doesn’t truly enforce constants. Instead, we follow a professional convention: PI = 3.14 MAX_USERS = 1000 Uppercase indicates = “Please don’t change this.” It’s discipline, not enforcement, and discipline makes better developers. Constants is also the value that variable holds. For every constant there will be a specific memory. 🧠 And Then There Are Data Types… Every value in Python has a type: Integers → Whole numbers (25,-34) Float → Decimal numbers (99.99) String → Anything written inside '.....', "......." ,'''.....'''' or """....""" will be called as a string value. - it can be a character, a word or a sentence or even other datatypes Example-("Hello", " 65",'0.86','"false"') Boolean → True / False Data types define how Python behaves with that value. Add two integers? ✅ Add a string and an integer? ❌ Error. Programming isn’t about memorizing code. It’s about understanding how things actually work behind the scenes. Excited for what’s next 🚀 #DataScience #Python #SQL #ProgrammingBasics #LearningInPublic #CareerGrowth
To view or add a comment, sign in
-
-
🧠 Python Concept That Explains Class Namespaces: __prepare__ in Metaclasses Before a class is created… Python prepares its namespace 👀 🤔 What Is __prepare__? When Python executes: class MyClass: x = 1 y = 2 It first asks the metaclass: 👉 “What mapping should I use to store attributes?” That hook = __prepare__. 🧪 Example class OrderedMeta(type): @classmethod def __prepare__(mcls, name, bases): return {} def __new__(mcls, name, bases, namespace): print(list(namespace.keys())) return super().__new__(mcls, name, bases, namespace) class Demo(metaclass=OrderedMeta): a = 1 b = 2 c = 3 ✅ Output ['a', 'b', 'c'] Metaclass saw class body order 🎯 🧒 Simple Explanation 🧸 Before kids put toys in a box, teacher chooses the box. 🧸 That box = namespace. 🧸 Choice = __prepare__. 💡 Why This Matters ✔ Ordered class attributes ✔ DSLs & frameworks ✔ Enum internals ✔ ORM field order ✔ Metaprogramming ⚡ Real Uses 💻 Enum preserves order 💻 Dataclasses fields 💻 ORM column order 💻 Serialization frameworks 🐍 In Python, even class bodies have a setup phase 🐍 __prepare__ decides how attributes are collected, before the class even exists. #Python #PythonTips #PythonTricks #AdvancedPython #CleanCode #LearnPython #Programming #DeveloperLife #DailyCoding #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 3/60 – Variables & Data Types (The Foundation of Python) If you don’t understand this, Python will feel confusing. If you master this, everything becomes easy. Let’s break it down 👇 🧠 What is a Variable? A variable is like a container that stores data. Example 👇 name = "Adeel" age = 25 Here: • name stores text • age stores a number 🔢 Python Data Types (Most Important Ones) 1️⃣ String (Text) name = "Adeel" 2️⃣ Integer (Whole Number) age = 25 3️⃣ Float (Decimal Number) price = 99.99 4️⃣ Boolean (True/False) is_active = True 🧪 Let’s Print Them print(name) print(age) print(price) print(is_active) ⚡ Pro Tip (Very Important) Python is dynamically typed 👉 You don’t need to declare data types x = 10 x = "Now I am text" Same variable. Different type. ❌ Common Beginner Mistake name = Adeel # ❌ Error Correct way: name = "Adeel" # ✅ Always use quotes for text. 🔥 Challenge for today Create 4 variables: • Your name • Your age • Your favorite number • Are you learning Python? (True/False) Then print all of them. Comment “DONE” when finished ✅ Follow Adeel Sajjad if you’re serious about learning Python in 60 days 🚀 #Python #LearnPython #PythonProgramming #Coding #Programming
To view or add a comment, sign in
-
-
When I stop using Python and switch back to SQL. I like Python. It’s flexible, expressive, and great for exploration. But there’s a point where I deliberately put it down and move back to SQL. That moment usually comes when the work needs to be: reproducible, not just correct once, reviewable by others and easy to rerun as data updates. Python is where I explore: test assumptions, prototype logic, sanity-check edge cases etc. SQL is where I formalise: define metrics clearly, apply business rules consistently and create outputs others can trust. In my opinion, if an analysis is likely to be reused, audited, or built on by someone else, SQL almost always wins. It’s not about which tool is more powerful, It’s about what stage the work is in. Knowing when to switch has been far more valuable than knowing more syntax. How do you approach this? what’s your signal that it’s time to move from exploration to structure? #DataAnalytics #SQL #Python #AnalyticsEngineering
To view or add a comment, sign in
-
-
Day 2/20 Let's play a game. 🎮 Python edition. Yesterday we committed to this 20-day challenge. Today, we actually learn something. 😄 We're starting with the building blocks of Python—Lists and Loops. Think of them as the containers and conveyor belts of data. But instead of me just lecturing... let's make this interactive. Here's a tiny code snippet: ```python tech_stack = ["Python", "SQL", "Machine Learning", "Cloud"] for tool in tech_stack: print("I'm learning " + tool) ``` POP QUIZ: What will this code output? 👇 A) Just "Machine Learning" B) An error because it's wrong C) Four lines, each saying "I'm learning [tool]" D) "PythonSQLMachine LearningCloud" all mashed together Drop your answer in the comments! (Be honest, no cheating! 😉) Today's mini-lesson: This is how we process data in Python. The list holds the items, the loop goes through each one. This exact concept scales all the way up to processing millions of data points for Machine Learning. We start small so we can go big. 🚀 Question for you: What's one Python concept you always forget? For me, it's list slicing syntax. Every. Single. Time.
To view or add a comment, sign in
-
-
🤸 Week 2 of 180 — Python finally has a BRAIN now! 🧠 Last session I learned Lists — how to store data. Today? I learned how to control what Python DOES with that data. 💥 Loops & Control Statements — and this is where programming starts feeling like actual logic. 👇 🤔 Why do we even need this? Without control flow, Python just runs every line top to bottom. Boring. 😴 With control flow, Python can: → Make decisions using if-elif-else → Repeat tasks using for or while → Exit early, skip steps, or do nothing using break, continue, pass These are the backbone of logic in every Python program. 🦴 🧭 Part 1 — if-elif-else (Making Decisions) age = 18 if age >= 18: print("You can vote.") # ✅ this runs elif age >= 16: print("Almost there!") # skipped else: print("You cannot vote.") # skipped if checks the first condition. elif checks the next one if if was False. else is the fallback — runs only when everything above fails. 🛡️ 🔁 Part 2 — for Loop (Iterate over sequences) Use for when you know exactly how many times to loop. names = ["Alice", "Bob", "Charlie"] for name in names: print(name) # Alice # Bob # Charlie Works on lists, strings, dictionaries — anything iterable! 🔄 ⏳ Part 3 — while Loop (Run until condition is False) Use while when you DON'T know how many times to loop. i = 1 while i <= 5: print(i) i += 1 # prints 1 2 3 4 5 ⚠️ Always update your variable inside while — or you'll be stuck in an infinite loop forever. 😂 🎮 Part 4 — break, continue, pass # break → EXIT the loop completely for i in range(10): if i == 5: break # stops at 5, never reaches 6,7,8... # continue → SKIP this step, go to next for i in range(5): if i == 2: continue # skips 2, prints 0,1,3,4 # pass → DO NOTHING (placeholder) for i in range(3): pass # valid empty loop, no error! 🎯 Part 5 — range() + else with Loops # range() — generate number sequences for i in range(1, 6): print(i) # 1 2 3 4 5 # else with loop — runs when loop completes WITHOUT break for i in range(3): print(i) else: print("Loop finished successfully!") # 🎉 That else with loops was a surprise — I didn't know Python could do that! 😲 💡 The Big Mental Model I have now: if-elif-else = Python DECIDING 🤔 for = Python REPEATING a known number of times 🔁 while = Python WAITING until something changes ⏳ break/continue/pass = Python CONTROLLING the flow 🎮 📅 Week 2 / 180 — Loops & Control: DONE! ✅ Grinding through my 6-Month GenAI & Agentic AI Certificate Program 🏛️ IIT Patna Certified while still_learning: keep_going() # this is me right now 😂 💬 Which one confused you more when you started — break or continue? 👇 ♻️ Repost if this made control flow click for you! #Python 🐍 #Loops #ControlFlow #IfElse #ForLoop #WhileLoop #Week2 #GenAI 🤖 #IITPatna 🏛️ #LearningInPublic #100DaysOfCode #PythonBasics #CodingJourney #AgenticAI #NeverStopLearning 🚀 #BuildInPublic
To view or add a comment, sign in
-
-
🧠 Python Concept That Explains Attribute Lookup Order: Descriptor Lookup Chain When you access: obj.attr Python follows a precise order 👀 🔍 The Real Lookup Order Python checks in this exact sequence: 1️⃣ Data descriptor (__set__ / __delete__) 2️⃣ Instance __dict__ 3️⃣ Non-data descriptor (__get__) 4️⃣ Class __dict__ 5️⃣ __getattr__ 🧪 Example Insight class D: def __get__(self, obj, owner): return "descriptor" class C: x = D() c = C() c.x = "instance" print(c.x) ✅ Output instance Because instance dict beats non-data descriptor. 🧒 Explain Like I’m 5 Imagine looking for a toy 🧸 1️⃣ Guard holding it 2️⃣ Your bag 3️⃣ Shelf 4️⃣ Store 5️⃣ Ask someone That order = lookup chain. 💡 Why This Matters ✔ Descriptor behavior ✔ Properties ✔ ORMs ✔ Framework internals ✔ Debugging weird attribute bugs ⚡ Key Rule 🐍 Data descriptors override instance attributes. 🐍 Non-data descriptors don’t. 🐍 Attribute access in Python isn’t random. 🐍 It follows a precise chain 🐍 Understanding the descriptor lookup order explains many “magic” behaviors. #Python #PythonTips #PythonTricks #AdvancedPython #CleanCode #LearnPython #Programming #DeveloperLife #DailyCoding #100DaysOfCode
To view or add a comment, sign in
-
-
🐍 Python Data Types – Easy Memory Cheat Sheet When I started learning Python, remembering all the methods for List, Dictionary, Set, and String felt overwhelming. Instead of memorizing everything randomly, I discovered a simple trick: group methods by their functionality. 🔹 List → AROC Add: append(), insert(), extend() Remove: remove(), pop(), clear() Order: sort(), reverse() Check: index(), count() 🔹 Dictionary → AUR Access: keys(), values(), get() Update: update(), setdefault() Remove: pop(), popitem(), clear() 🔹 Set → ARM Add: add(), update() Remove: remove(), discard() Math operations: union(), intersection(), difference() 🔹 String → CCFS Clean: strip(), replace(), split() Check: isalpha(), isdigit() Format: lower(), upper(), title() Search: find(), count(), startswith() 💡 Developer Tip: You don’t need to memorize every method. Use: dir(list), dir(dict), dir(set), dir(str) to explore them interactively. 📌 Sharing this cheat sheet to help beginners learn Python faster. If you're learning Python, this might save you hours of confusion! #Python #PythonProgramming #CodingTips #LearnPython #Programming #SoftwareDevelopment
To view or add a comment, sign in
-
-
Python Tip Every Beginner Should Know One concept that saves you from many bugs in Python Mutable vs Immutable Objects In Python, some objects can change after creation, while others cannot. 🔹 Immutable Objects (cannot change) Examples: int, float, string, tuple x = 10 x = x + 5 print(x) Here Python creates a new object instead of modifying the original one. Another example: name = "Python" name[0] = "J" # Error Strings are immutable, so their values cannot be changed. 🔹 Mutable Objects (can change) Examples: list, dictionary, set numbers = [1, 2, 3] numbers.append(4) print(numbers) Output: [1, 2, 3, 4] Here the same list object is modified. 💡 Why this matters? If you pass a list to a function, the original data can change. def add_item(lst): lst.append(100) data = [1, 2, 3] add_item(data) print(data) Output: [1, 2, 3, 100] Understanding this concept helps a lot in: ✔ Data Analysis ✔ Machine Learning ✔ Writing clean Python code 📌 Tip: If you want to avoid modifying the original list: new_list = old_list.copy() Small Python concepts like this make a big difference in writing better code. If you're learning Python, remember this: Mutable → Can change Immutable → Cannot change If you're learning Python, mastering small concepts like this makes a big difference. #Python #PythonProgramming #Coding #DataScience #LearnPython #ProgrammingTips #DataAnalyst
To view or add a comment, sign in
-
Encapsulation In Python: combined single units into multiple units public data protected data private data #publicdata() '''class parent(): publicdata=10 def publicmethod1(self): print(self.publicdata) class child(parent): def publicmethod2(self): print(self.publicdata) obj1=child() obj1.publicmethod1() obj1.publicmethod2() 10 10''' #_protcteddata '''class parent(): _protecteddata=100 def method1(self): print(self._protecteddata) class chiled(parent): def method2(self): print(self._protecteddata) obj1=chiled() obj1.method1() obj1.method2() 100 100''' #__privatedata '''class parent(): __privatedata="lakshmi" def method1(self): print(self.__privatedata) class child(parent): def method2(self): print(self._parent__privatedata) obj1=child() obj1.method1() obj1.method2()''' output: lakshmi lakshmi Pooja Chinthakayala Mam,Saketh Kallepu Sir,Uppugundla Sairam Sir.
To view or add a comment, sign in
Explore related topics
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