def Change(X):
for K, V in X.items():
L1.append(K)
L2.append(V)
D = {1: "ONE", 2: "TWO", 3: "THREE"}
L1 = []
L2 = []
Change(D)
print(L1)
print(L2)
print(D)
Execution proceeds as follows:
Initialize dictionary D to {1: "ONE", 2: "TWO", 3: "THREE"}.
Initialize lists L1 and L2 as empty.
Call function Change(D).
Inside the function:
The state of L1 and L2 evolves with each iteration:
Dictionary D remains unchanged by the function.
Function output:
[1, 2, 3]
['ONE', 'TWO', 'THREE']
{1: 'ONE', 2: 'TWO', 3: 'THREE'}
