upd
This commit is contained in:
10
ex6.2.2/bernoulli/data1.csv
Normal file
10
ex6.2.2/bernoulli/data1.csv
Normal file
@@ -0,0 +1,10 @@
|
||||
0.000000
|
||||
0.000000
|
||||
0.000000
|
||||
0.000000
|
||||
1.000000
|
||||
1.000000
|
||||
0.000000
|
||||
0.000000
|
||||
0.000000
|
||||
0.000000
|
||||
|
10000
ex6.2.2/bernoulli/data2.csv
Normal file
10000
ex6.2.2/bernoulli/data2.csv
Normal file
File diff suppressed because it is too large
Load Diff
16
ex6.2.2/bernoulli/main.py
Normal file
16
ex6.2.2/bernoulli/main.py
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
def main():
|
||||
with open("data2.csv", 'r') as data:
|
||||
s = 0
|
||||
c = 0
|
||||
for v in data:
|
||||
s += float(v)
|
||||
c += 1
|
||||
|
||||
p = s / c
|
||||
print(f"p = {p}")
|
||||
d = p * (1 - p)
|
||||
print(f"d = {d}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user