🐍 90 Days of Python – Day 19 List Comprehensions Today, I learned about list comprehensions in Python, a more concise and Pythonic way to create lists. List comprehensions help combine loops, conditions, and expressions into a single readable line, making code cleaner and easier to understand. 🔹 Key things I learned today: • Basic syntax of list comprehensions • Creating lists using expressions • Adding conditional logic inside comprehensions • Replacing simple for loops with more compact code List comprehensions are especially useful in data processing and transformations, where readability and efficiency matter. I’m practicing these concepts to write cleaner and more expressive Python code. 📌 Day 19 completed. Writing more Pythonic code with list comprehensions. 👉 Do you prefer list comprehensions or traditional for loops, and why? #90DaysOfPython #PythonLearning #LearningInPublic #ListComprehension #PythonDeveloper #BTechCSE
90 Days of Python: List Comprehensions
More Relevant Posts
-
Today’s Python focus was 𝗠𝗼𝗱𝘂𝗹𝗲𝘀. I worked on understanding how Python lets you organize code into reusable files instead of writing everything in one script. 𝗪𝗵𝗮𝘁 𝗜 𝗽𝗿𝗮𝗰𝘁𝗶𝗰𝗲𝗱 𝘁𝗼𝗱𝗮𝘆: • Importing built in modules like math and calendar • Using functions from the math module such as sqrt() and ceil() • Working with the calendar module to generate month level calendars • Creating a custom module to store reusable functions • Importing and using functions from a user defined module • Separating logic into different files for better structure and readability 𝗞𝗲𝘆 𝘁𝗮𝗸𝗲𝗮𝘄𝗮𝘆𝘀: • Modules help break large programs into smaller, manageable pieces • Built in modules save time and prevent rewriting common logic • Custom modules make code reusable across multiple scripts • Organizing functions into modules improves maintainability Working with modules made it clear how real Python projects are structured. Code is written once, organized properly, and reused when needed. If you are learning Python, are you already using modules in your practice or still keeping everything in a single file? #Python #PythonLearning #PythonModules #ProgrammingBasics #LearningInPublic #DataAnalytics #Upskilling
To view or add a comment, sign in
-
🐍 Day 3 of My Python Journey: Variable Re-initialization Today I learned something fundamental yet powerful - variables in Python are incredibly flexible! Unlike some languages where you're locked into a data type, Python lets you reassign variables to completely different types: python x = 42 # I'm an integer x = "Hello" # Now I'm a string x = [1, 2, 3] # Now I'm a list Key takeaways: Variables are just labels pointing to objects in memory You can change what a variable points to at any time Python automatically handles the type conversion The old value gets garbage collected if nothing else references it Practical use case I tried: python user_input = input("Enter a number: ") # String user_input = int(user_input) # Now it's an integer result = user_input * 2 This flexibility makes Python beginner-friendly, but I'm learning to be mindful about keeping my code readable and maintaining consistent variable purposes. What's a Python concept that surprised you when you first learned it? #Python #100DaysOfCode #LearnPython #PythonProgramming #CodingJourney #TechLearning
To view or add a comment, sign in
-
-
Day 3 of Python. Writing code once. Using it everywhere. Today’s focus was functions and modules. This is where Python stopped feeling like a scripting language and started feeling like a system tool. What I worked on: Writing reusable functions Passing data through parameters Returning predictable outputs Organizing logic into modules The key realization: Repetition is a design problem. If the same logic appears in multiple places: Bugs multiply Fixes become risky Pipelines turn fragile Functions solve logic. Modules protect structure. This is how Python scales from notebooks to production: One function. One responsibility. Shared utilities across files. Clean imports instead of copy-paste. This mindset is critical before touching Pandas or building pipelines. Tomorrow: applying this structure to real datasets. If you work with Python: What was the first function you automated that saved you real time? #datawithanurag #dataxbootcamp
To view or add a comment, sign in
-
-
⚠️ Python Gotcha: Defining the Same Method Twice in a Class Did you know that Python does NOT support method overloading by definition order inside a class? Consider this scenario 👇 You define the same method name twice inside a class, expecting both to exist… Only the LAST definition survives. What actually happens? Python reads the class top to bottom When it sees the second func1, it completely overwrites the first one The first method is lost and ignored No warning. No error. Just replacement. Example outcome Nirmal.func1(2, 4) Runs the second version only Output: Good Morning Result is: 6 🚨 Key Takeaways Python does not support traditional method overloading Method names inside a class must be unique If you need different behaviors: Use different method names Or use default parameters / *args / conditional logic 🧠 Pro Tip If your logic seems to “mysteriously change” — check whether a method name was accidentally redefined. Learning these small details makes a big difference in writing clean, predictable Python code 🐍 #Python #OOP #ProgrammingTips #LearningPython #Developers #CodeSmart
To view or add a comment, sign in
-
-
Ever installed a Python package... and still got ModuleNotFoundError? Most of the time, the package isn’t missing. It’s just installed in a different Python. That confusion is what I built Mustel for. Mustel is a small Python CLI tool that helps you: ✔️see which Python you’re actually using. ✔️see what packages are installed where. ✔️understand environment mismatches clearly. ✔️It doesn’t modify your system. ✔️It just makes Python environments visible. Install: pip install mustel Docs: https://lnkd.in/dncSmRDd PyPI: https://lnkd.in/dbDhr673 Built while learning Python packaging and CLI internals. #lauchpost #mustel #python #learning #project #pythonpackage #pypi
To view or add a comment, sign in
-
🚀 Advanced Python Tips #4: print() Tricks and tips you may not know, and that are rarely taught in Python courses. Most developers think they know print(), but surprisingly few have actually read its documentation. The print function receives any number of objects via *args and converts them to strings. What many people don’t know is that it also supports useful keyword arguments: - sep – separator between objects - end – what is printed after the last object - file – where the output is written (default is stdout) - flush – forces the output buffer to flush immediately By default, Python uses a space (" ") as sep and a newline ("\n") as end. But using end=", " inside a loop can save you from generating huge, hard-to-read log files. Small details like this can make debugging and logging much cleaner. Did you know you could prevent print() from breaking the line?
To view or add a comment, sign in
-
-
🚀 Day 46 of My Python Learning Journey 🐍 Today, I learned Operator Overloading in Python, an important Object-Oriented Programming (OOP) concept. 🔹 Understood how Python uses magic (dunder) methods like: __add__(), __len__(), __eq__(), __gt__() 🔹 Learned how operators such as + and len() can be customized for user-defined classes 🔹 Practiced real-world examples: Adding two objects using __add__() Finding object length using __len__() Merging objects (ShoppingCart example) 💡 Key takeaway: Operator overloading helps write clean, readable, and object-oriented code, and it’s a favorite interview topic. 📈 Slowly building strong Python OOP foundations, one concept at a time! #Python #OOP #OperatorOverloading #MagicMethods #PythonLearning #DataAnalystJourney #CodingPractice #Day46
To view or add a comment, sign in
-
-
🚀 Python for Beginners – Post 8/∞ 🧠 Python Memory Secrets: How Variables Really Work Many beginners think variables store values. But in Python… that’s not the full truth 👀 👉 Variables don’t store values — they store references. What this means: ✔ Multiple variables can point to the same object ✔ Small integers & short strings may share memory (interning) ✔ Reassigning a variable doesn’t change the object — it changes the reference ✔ Python automatically cleans unused objects (Garbage Collection) 💡 Understanding this concept helps you: • Avoid confusing bugs • Write memory-efficient code • Think like a real Python developer If this concept feels tricky now, that’s okay — clarity comes with practice 🔁 📌 Save this post for revision 💬 Comment “MEMORY” if you want a simple hands-on example next 🔄 Share if this helped your learning journey #PythonForBeginners #LearnPython #PythonConcepts #PythonDeveloper #ProgrammingBasics #CodingJourney #SoftwareEngineering #TechLearning #PythonTips
To view or add a comment, sign in
-
-
Why is Python the world’s most popular language? It’s all about the "Magic Box." 📦✨ Python: Coding Made Simple In many languages, you have to be strict about labels. But Python is flexible. The Secret? Dynamic Typing: Reusable Containers: Variables are just boxes that store data during a program. Swap on the Fly: You can put a Number (10) in the box, then instantly swap it for a Word ("Hello"). No Labeling Stress: Python figures out the data type for you automatically. The 4 Essentials: Int: Whole numbers Float: Decimals String: Text in quotes Boolean: True or False Python handles the memory; you focus on the logic. 🚀 #Python #Coding #TechMadeSimple #Learning #Tips
To view or add a comment, sign in
-
-
🐍 90 Days of Python – Day 22 Tuples in Python Today, I learned about tuples in Python, an immutable data structure used to store ordered collections of elements. Tuples are useful when data should not be modified, helping ensure safety and consistency in programs. 🔹 Key concepts I explored today: • Creating tuples using () • Understanding immutability in tuples • Accessing elements using indexing • When to use tuples instead of lists Tuples are commonly used to return multiple values from functions and to store fixed data that should remain unchanged. 📌 Day 22 completed. Working with immutable data in Python. 👉 Where do you think tuples are more useful than lists? #90DaysOfPython #PythonLearning #LearningInPublic #PythonTuples #BTechCSE #PythonDeveloper
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