If you get this right… your Python fundamentals are solid 😏 Python Series — Day 4 🧠 This one has confused a lot of developers (including me once 👀) What will be the output? def add_item(item, lst=[]): lst.append(item) return lst print(add_item(1)) print(add_item(2)) print(add_item(3)) Options: A. [1] [2] [3] B. [1] [1, 2] [1, 2, 3] C. Error D. Something unexpected 👀 Don’t rush this one. 👉 Think: Is the list created every time… or reused? Drop your answer 👇 Let’s see who gets it right 🔥 Answer tomorrow 🚀 #Python #CodingChallenge #LearningInPublic #Tech #DataEngineering
Python List Append Behavior Confusion
More Relevant Posts
-
Python Logic: Is this Math or Magic?🤔 Day 8 of my Python journey! C++ logic tells me: You can't add words to numbers. Python logic says: Hold my coffee ☕ Check out this snippet: result = True + True + False * True What do you think the print(result) output will be? Drop your guess in the comments! 👇 A) True B) 2 C) 3 D) Error Hint💡: It comes down to how Python stores Booleans as Integers! #Python #LearninginPublic #30DaysOfCode #ProgrammingLogic #Day8
To view or add a comment, sign in
-
-
👉 We all use quotes in Python… But do you know when to use: ' vs " vs '''? Most beginners just use them randomly. Here’s the simple rule 👇 # Single quotes → simple text name = 'Ali' # Double quotes → when text has ' msg = "It's a good day" # Triple quotes → multi-line / docstrings text = '''This is multi-line text''' That’s it. No confusion. No overthinking. --- 💡 Good code is not just about working… It’s about being clear and readable. --- Do you follow this… or just use quotes randomly? #Python #LearnPython #CodingBasics #ProgrammingConcepts #PythonTips #CodeClarity #CleanCode #LearnWithMe #strings
To view or add a comment, sign in
-
-
🧠 Python Logic Check — Quick Challenge Consider the following snippet: x = 10 x += x == 10 print(x) At first glance, it looks straightforward — but it tests your understanding of how Python handles boolean expressions. 💡 Question: What will be the output? A) 10 B) 11 C) True D) Error 📌 Small details like this often separate beginners from experienced developers. 💬 Drop your answer in the comments — and explain your reasoning if you can. #Python #SoftwareEngineering #CodingChallenge #DeveloperMindset #Learning
To view or add a comment, sign in
-
-
🚀 Day 2/30 – Python Challenge Continuing my Python journey! 🐍 🔹 Key Concepts: * Different data types in Python * Integer, Float, String, Boolean * Storing values using variables 💻 Mini Task: Created variables of different data types and printed them to understand how Python handles each type. 🎯 Learning Outcome: Learned how Python supports multiple data types and how to use them effectively in programs. Step by step getting more comfortable with coding! 💻✨ #Python #CodingChallenge #LearningJourney #AI #StudentDeveloper #Day2
To view or add a comment, sign in
-
-
Python Tip of the Day 🐍 Choosing the right file mode in Python is more important than it seems. w and w+ may look similar, but they serve different purposes: w → Write only w+ → Write + Read Both modes create the file if it doesn’t exist and overwrite existing data, which makes them powerful—but also risky if used carelessly. Day 43 of building Python basics #Python #FileHandling #LearnPython #ProgrammingBasics #PythonTips
To view or add a comment, sign in
-
-
🚀 Day 85 – Python + DSA Journey Today I focused on strengthening my fundamentals in Arrays and problem-solving using Python. 🔹 Topics Covered: • Array Traversal, Insertion, Deletion • Time Complexity (O(n), O(1)) • Problem-Solving Patterns 🔹 Problems Solved: ✅ Find Second Largest Element (Optimized O(n) approach) ✅ Reverse an Array (Two-pointer technique) ✅ Move Zeros to End (Efficient swapping logic) ✅ Two Sum Problem (Hashing concept) 💡 Key Learnings: • Importance of thinking in terms of patterns • Optimizing solutions without using sorting • Writing clean and efficient code for interviews Every day I’m getting better at breaking down problems and building logical solutions. 📌 Consistency is the key — one step closer to my goal every day! #Day85 #Python #DSA #CodingJourney #ProblemSolving#Learning #SoftwareDevelopment
To view or add a comment, sign in
-
🧠 Python Trap You’ll Probably Hit Once When you create a list using multiplication like * 3, Python doesn’t create separate inner lists. Instead, it creates multiple references to the same list in memory. So when you modify one, all of them change together. But when you use a list comprehension, each inner list is created independently. That means changes stay isolated, exactly as you’d expect. This small difference is responsible for a lot of confusing bugs, especially in nested data structures. Reference: https://lnkd.in/gWBiknUH #pythonprogramming #learnpython #coding #python
To view or add a comment, sign in
-
-
🚀 Day 46 of My Learning Journey Today I explored one of Python’s most powerful functions — eval(). 💡 What is eval()? It is a built-in Python function that evaluates a string as a Python expression and executes it. 🔍 Example: 👉 eval("9 + 5") → 14 👉 If x = 2, then eval("x + 3") → 5 ✨ What I learned: ✔️ eval() can execute expressions stored as strings ✔️ It can access variables, functions, and even built-in methods ✔️ Useful for dynamic calculations and quick evaluations ⚠️ Important Note: eval() should be used carefully because it can execute any code, which may lead to security risks if used with untrusted input. 🎯 Mini Task Solved: Took user input as a string and executed it using eval() — simple yet powerful! 📌 Key Takeaway: “Just because something is powerful doesn’t mean it should be used everywhere.” #Day46 #Python #CodingJourney #LearnToCode #100DaysOfCode #PythonProgramming #TechSkills
To view or add a comment, sign in
-
-
I improved my first Python project. Initially, it only calculated averages and grades. Now I added: - Class statistics - Ranking system - Subject-wise toppers This helped me understand how to work with structured data and apply logic step-by-step. Small improvements, but real progress. Code: https://lnkd.in/dRwGrnhh #Python #DataScience #LearningInPublic #BeginnerProjects
To view or add a comment, sign in
-
Rules for declaring python veriables:- 1) Must start with letters (a-z, A-Z) or underscore _ 2)Must not start with numbers (1 to .... ) 3) Variables are case sensitive ( python and Python both are different) 4) We cannot use keywords as variables ( if, def, while ...) Variable declaration is main part of any program. First impression will be starting with it, so while declaring variables need to take care. #python #learn #fast #beginner #automation
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