What is the output of the following code?
x = 10
def outer():
x = 5
def inner():
nonlocal x
x += 1
return x
return inner
f = outer()
print(f())
print(f())
A)
B)
C)
D)
x = 10
def outer():
x = 5
def inner():
nonlocal x
x += 1
return x
return inner
f = outer()
print(f())
print(f())
A)
6 7B)
11 12C)
5 6D)
ErrorWhat is the output of this code?
a = [1, 2, 3]
b = a[:] a[0] = 100 b[1] = 200 print(a, b)
a = [1, 2, 3]
b = a[:] a[0] = 100 b[1] = 200 print(a, b)
Anonymous Quiz
20%
[100, 2, 3] [100, 200, 3]
16%
[100, 200, 3] [100, 2, 3]
6%
[1, 2, 3] [1, 2, 3]
58%
[100, 2, 3] [1, 200, 3
❤3
Python
What is the output of this code?
a = [1, 2, 3]
b = a[:] a[0] = 100 b[1] = 200 print(a, b)
a = [1, 2, 3]
b = a[:] a[0] = 100 b[1] = 200 print(a, b)
Code:
a = [1, 2, 3]
b = a[:]
a[0] = 100
b[1] = 200
print(a, b)
a = [1, 2, 3]
b = a[:]
a[0] = 100
b[1] = 200
print(a, b)
❤2