In [1]:
N, p = 10, 0.3
In [2]:
q = 1 - p
answer = sum((n+q) for n in range(N)) / (p * q)
print(answer)
247.61904761904762