""" Exercise 5.1 from "A primer on..." Fill two lists with values, using the same recipe as introduced earlier, using a for-loop and append. """ import numpy as np def h(x): return (1 / np.sqrt(2 * np.pi)) * np.exp(-0.5 * x**2) xlist = [] hlist = [] a = -4 b = 4 n = 41 dx = (b - a) / (n-1) for i in range(n): x = a + i * dx xlist.append(x) hlist.append(h(x)) print(xlist) print(hlist) """ python fill_lists.py [-4.0, -3.8, -3.6, -3.4, -3.2, -3.0, -2.8, -2.5999999999999996, (...) 3.6000000000000005, 3.8000000000000007, 4.0] [np.float64(0.00013383022576488537), (...) , np.float64(0.00013383022576488537)] """