smathieson@smathieson-20 disc-pg-gan % python3 Python 3.8.2 (default, Dec 21 2020, 15:06:04) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import random >>> >>> >>> total = 0 >>> for i in range(10): ... total += random.randrange(1,7) # die ... >>> total 41 >>> rolls = [random.randrange(1,7) for i in range(10)] >>> rolls [5, 6, 4, 5, 5, 4, 5, 6, 3, 1] >>> rolls = [random.randrange(1,7) for i in range(10)] >>> rolls [2, 1, 2, 6, 5, 4, 1, 6, 5, 6] >>> >>> import matplotlib.pyplot as plt >>> >>> >>> >>> plt.plot(range(10), rolls) [] >>> plt.show() >>> plt.scatter(range(10), rolls) >>> plt.show() >>> rolls = [random.randrange(1,7) for i in range(10000)] >>> plt.hist(rolls) (array([1649., 0., 1641., 0., 1692., 0., 1620., 0., 1666., 1732.]), array([1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. ]), ) >>> plt.show() >>> random.random() 0.5151881918643507 >>> random.random() 0.9820611256833769 >>> random.random() 0.0004928543212465719 >>> random.random() 0.08001414800251094 >>> >>> >>> >>> import numpy as np >>> >>> >>> arr = np.zeros((3,4)) >>> arr array([[0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.]]) >>> arr[0,:] array([0., 0., 0., 0.]) >>> arr[:,0] array([0., 0., 0.]) >>> arr[:,0:3] array([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]) >>> arr[:,:3] array([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]) >>> >>> arr[2,1] = 7 >>> arr array([[0., 0., 0., 0.], [0., 0., 0., 0.], [0., 7., 0., 0.]]) >>> arr.shape (3, 4) >>> >>> >>> >>> >>> a = [2,3,4] >>> >>> >>> a.shape Traceback (most recent call last): File "", line 1, in AttributeError: 'list' object has no attribute 'shape' >>> >>> >>> b = a >>> >>> b [2, 3, 4] >>> >>> >>> b[1] = 8 >>> >>> >>> b [2, 8, 4] >>> >>> >>> >>> a [2, 8, 4] >>> >>> >>> x = 5 >>> y = x >>> y 5 >>> y = 3 >>> x 5