Quick Quiz!

1

What should the output of the following snippet be?

funcs = []
for x in range(7):
    def some_func(x=x):
        return x * x
    funcs.append(some_func)

funcs_results = [func() for func in funcs]
print(funcs_results)
A)
[36, 36, 36, 36, 36, 36, 36]
B)
[0, 1, 4, 9, 16, 25, 36]
C)
TypeError: some_func() missing 1 required positional argument: 'x'
Question 1 of 40 attempted

Get hands-on with 1200+ tech skills courses.