Mutating a Shared List Argument
def add_item(cart):
cart.append("apple")
my_cart = ["bread"]
add_item(my_cart)
print(my_cart)
What does this print?
Sign in to answer questions and track your progress
Sign Indef add_item(cart):
cart.append("apple")
my_cart = ["bread"]
add_item(my_cart)
print(my_cart)
What does this print?
Sign in to answer questions and track your progress
Sign In