-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdatagame.py
More file actions
45 lines (26 loc) · 782 Bytes
/
datagame.py
File metadata and controls
45 lines (26 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# genrating random data with numpy and matplotlib then finding the mean and standard deviation of the data
import numpy as np
import matplotlib.pyplot as plt
# generate random data
data = np.random.randn(1000)
# plot the data
plt.hist(data, bins=20)
plt.show()
# calculate the mean and standard deviation
mean = np.mean(data)
std = np.std(data)
print("Mean:", mean)
print("Standard deviation:", std)
# calculate the mean and standard deviation of the data
mean = np.mean(data)
std = np.std(data)
# generate random data
data = np.random.randn(1000) * std + mean
# plot the data
plt.hist(data, bins=20)
plt.show()
# calculate the mean and standard deviation of the data
mean = np.mean(data)
std = np.std(data)
print("Mean:", mean)
print("Standard deviation:", std)