Python Interview Question: Mutable Default Arguments

🐍 Day 11 of My 30-Day Python Learning Challenge Today I learned an important Python concept often asked in interviews. 📌 What will be the output? def func(value, lst=[]): lst.append(value) return lst print(func(1)) print(func(2)) print(func(3)) 🤔 Think before you answer! 📊 Options: A) [1] [2] [3] B) [1] [1,2] [1,2,3] C) Error D) None of these 💡 This question tests understanding of mutable default arguments — a common mistake many beginners make. Answer tomorrow 👇 #Python #CodingInterview #ProblemSolving #LearningInPublic #SoftwareDeveloper

To view or add a comment, sign in

Explore content categories