Python Series — Day 3 🧠 Let’s level it up a bit 👇 What will be the output of this code? def modify_list(lst): lst.append(4) a = [1, 2, 3] modify_list(a) print(a) Options: A. [1, 2, 3] B. [1, 2, 3, 4] C. Error D. None Think carefully 👀 (Hint: It’s not about functions… it’s about how Python handles data) Drop your answer 👇 Answer tomorrow 🚀 #Python #CodingChallenge #LearningInPublic #DataEngineering #Tech
Python List Modification Challenge
More Relevant Posts
-
Python Clarity Series – Episode 25 Topic: Mutable vs Immutable Function Behavior 📌 Why did my list change after function call? def modify(lst): lst.append(100) a = [1, 2] modify(a) print(a) Output: [1, 2, 100] 👉 Lists are mutable → changes reflect outside Now: def modify(x): x = x + 10 a = 5 modify(a) print(a) Output: 5 👉 Integers are immutable → no change outside 💡 Rule: Mutable → changes persist Immutable → changes don’t This confusion causes logic errors. #PythonBasics #FunctionConcepts #StudentClarity #python #clarity
To view or add a comment, sign in
-
-
Python Series — Day 1 Answer + Day 2 Question 🚀 🧠 Day 2 Question What will be the output of this code? a = [1, 2, 3] b = a b.append(4) print(a) Options: A. [1, 2, 3] B. [1, 2, 3, 4] C. Error D. Depends on Python version Drop your answer 👇 (And don’t Google 😄) Answer tomorrow 🚀 #Python #CodingChallenge #DataEngineering #LearningInPublic #Tech
To view or add a comment, sign in
-
-
Day 28 / #120DaysOfCode – LeetCode Challenge 🚀 Consistency is building momentum 💯 Today’s focus was on String Processing and Frequency Counting, using Python’s built-in tools for efficient solutions. ✅ Problem Solved: • Most Common Word 💻 Language: Python 📚 Key Learnings: • Used regex (re.findall) to extract words cleanly • Applied Counter to count word frequency efficiently • Learned how to handle case-insensitive strings • Filtered out unwanted words using conditions Clean code + built-in functions = powerful solutions 🚀 Every day improving step by step 💪 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #Strings #Regex #ProblemSolving #CodingJourney #Consistency #120DaysOfCode
To view or add a comment, sign in
-
-
Most implementations of the State pattern in Python look very “clean”. Lots of small classes. A base interface. One class per state. But if you’ve ever worked with one in a real project, you know the downside: transitions are scattered, behaviour is hard to see in one place, and adding new states often means touching multiple files. In today’s video, I rebuild the State pattern in a very different way. Instead of relying on inheritance, I make the state machine explicit as data and use decorators to define transitions. The result is a small, reusable engine where the entire flow becomes visible at a glance. If you’re interested in writing Python that’s easier to reason about and extend, this is a pattern worth understanding. 👉 Watch here: https://lnkd.in/eg22yEHR. #python #softwaredesign #designpatterns #statemachine #cleancode
To view or add a comment, sign in
-
-
🐍 Day 117 — Hyperparameter Tuning Day 117 of #python365ai ⚙️ Tune model settings to improve performance. Example: from sklearn.model_selection import GridSearchCV 📌 Why this matters: Small changes can significantly improve results. 📘 Practice task: Tune one parameter in a model. #python365ai #HyperparameterTuning #ML #Python
To view or add a comment, sign in
-
-
Most implementations of the State pattern in Python look very “clean”. Lots of small classes. A base interface. One class per state. But if you’ve ever worked with one in a real project, you know the downside: transitions are scattered, behaviour is hard to see in one place, and adding new states often means touching multiple files. In today’s video, I rebuild the State pattern in a very different way. Instead of relying on inheritance, I make the state machine explicit as data and use decorators to define transitions. The result is a small, reusable engine where the entire flow becomes visible at a glance. If you’re interested in writing Python that’s easier to reason about and extend, this is a pattern worth understanding. 👉 Watch here: https://lnkd.in/e9Y3xGNF. #python #softwaredesign #designpatterns #statemachine #cleancode
To view or add a comment, sign in
-
-
Python Challenge – Can you solve this? Today was all about deep-diving into Lists vs. Sets and I came across a common mistake that we can sometimes overlook. Let’s test your Python understanding👇 numbers = [1, 2, 3] numbers.append([4, 5]) print(len(numbers)) A) 3 B) 4 C) 5 D) Error It’s a classic interview question that tests if you truly understand how Python handles memory and lists. Day 15/30 #30DaysOfCode #DataStructures #Day15 #PythonQuiz
To view or add a comment, sign in
-
-
🐍 Day 116 — Cross Validation Day 116 of #python365ai 🔁 Cross-validation splits data multiple times. Example: from sklearn.model_selection import cross_val_score 📌 Why this matters: Provides more reliable performance estimates. 📘 Practice task: Run cross-validation on a model. #python365ai #CrossValidation #MachineLearning #Python
To view or add a comment, sign in
-
-
🚀 Dictionaries (Python) Dictionaries are unordered collections of key-value pairs. They are defined using curly braces `{}`. Keys must be unique and immutable (e.g., strings, numbers, or tuples). Values can be of any data type. Dictionaries are useful for storing and retrieving data based on a key. #Python #PythonDev #DataScience #WebDev #professional #career #development
To view or add a comment, sign in
-
-
Day 60/100 — #100DaysOfCodingChallenge 60 days in… consistency is slowly turning into a habit now. 🔹 Python (DSA) Solved Search a 2D Matrix — used binary search by treating the matrix like a flattened sorted array. It was a nice reminder of how powerful binary search can be when applied smartly. 🔹 SQL Did some light practice to keep concepts fresh and maintain the streak. #Python #SQL #DSA #LeetCode #Day60 #100DaysOfCode #LearningInPublic #Consistency
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