...

/

Can I Call You Later?

Can I Call You Later?

We'll cover the following...

Should you call the functions first and then append the result, or append the functions and then call them later? Is there any difference? Let’s find out.

1.

Can you predict the output of the following code?

Press + to interact
funcs = []
results = []
for x in range(7):
def some_func():
return x
funcs.append(some_func)
results.append(some_func()) # note the function call here
funcs_results = [func() for func in funcs]
print(results)
print(funcs_results)

Even when the ...