Added 'Python/leno.py'
This commit is contained in:
parent
5a2d9e2441
commit
ea2c4386a2
21
Python/leno.py
Executable file
21
Python/leno.py
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/python3
|
||||
|
||||
bias = 0.52
|
||||
r_bias = 1 - bias
|
||||
|
||||
R = [0, 1, 2, 3]
|
||||
|
||||
N = len(R)
|
||||
|
||||
def p(n):
|
||||
if n == 0:
|
||||
return r_bias * (N-1)
|
||||
return bias * (N-1-n) * r_bias * n
|
||||
|
||||
sum = 0
|
||||
for i in R:
|
||||
k = p(i)
|
||||
sum += k
|
||||
print(f"p({i}) -> {k}")
|
||||
|
||||
print(sum)
|
Loading…
x
Reference in New Issue
Block a user