Sobes.tech
Intern — Middle

How will the lists change after calling the functions?

livecode

Task condition

Determine which output will appear in the console after executing the following code. Functions work with lists differently.


def modify_first(lst):
    lst[0] = 123

def reassign(lst):
    lst = [4, 5, 6]

list_a = [1, 2, 3]
list_b = [1, 2, 3]
modify_first(list_a)
print(list_a)
reassign(list_b)
print(list_b)
How will the lists change after calling the… - sobes.tech