from random import randint
from matplotlib.pyplot import plot, show

L = []
N = 10**5

for i in range(N):
    n = 1
    while randint(0,1) == 0:
        n += 1

    L.append(n)

X = []
Y = []

for k in range( 1 , max(L) + 1 ):
    X.append(k)
    Y.append( L.count(k) / N )

plot(X,Y)
show()
