Python Mutable Default Argument Bug

Find the Bug! 🐛🔍 def add(a, b=[]): b.append(a) return b print(add(1)) print(add(2)) What is the second output? 🖨️ A) [2] B) [1, 2] C) [2, 1] This is the most dangerous default argument in Python. ⚠️ 👇 **Comment A, B, or C!** Did you spot the mutable default trap? 🪤 #Debugging #Python #CodingChallenge #BugBounty #Tech

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories