NumPy - Fundamentals
Consider this code:
What is the expected output behavior?
import numpy as np import time lst = list(range(1000000)) arr = np.array(lst) start = time.time() squared_lst = [x**2 for x in lst] end = time.time() print(round(end - start, 3)) start = time.time() squared_arr = arr ** 2 end = time.time() print(round(end - start, 3))
What is the expected output behavior?
