In [1]:
# %%
import math
import matplotlib.pyplot as plt
%matplotlib inline  

xs = []
hs = []

for x in range(11, 320):
    p1 = 1 / (x / 10)
    h = p1 * math.log2(p1)

    p = (1 - p1) / 31
    for i in range(31):
        h += p * math.log2(p)

    xs.append(x / 10)
    hs.append(-h)

plt.plot(xs, hs)
plt.show()