Expectation find out with pyhton

The expected value of a random variable X is given by:
E ( X ) =∑xi pi

E(X) = 1( 1/6 ) + 2( 1/6 ) + 3( 1/6 ) + 4( 1/6 ) + 5( 1/6 ) + 6( 1/6 ) = 3.5

In python

>>>
import numpy as np
integer = [1, 2, 3, 4, 5, 6]
integer_array = np.array(integer)
expectation = np.mean(integer_array)
print(expectation)

………….Output…………….

3.5