# Sinh 300 số ngẫu nhiên từ U(2,10)
data <- runif(300, min = 2, max = 10)

# Tính kỳ vọng (mean) và phương sai (variance)
mean_val <- mean(data)
var_val <- var(data)

mean_val
## [1] 5.887836
var_val
## [1] 5.356235
import pandas as pd
import matplotlib.pyplot as plt

url = "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv"
iris = pd.read_csv(url)

print("5 dong dau:")
## 5 dong dau:
print(iris.head())
##    sepal_length  sepal_width  petal_length  petal_width species
## 0           5.1          3.5           1.4          0.2  setosa
## 1           4.9          3.0           1.4          0.2  setosa
## 2           4.7          3.2           1.3          0.2  setosa
## 3           4.6          3.1           1.5          0.2  setosa
## 4           5.0          3.6           1.4          0.2  setosa
print("\nGia tri nho nhat:")
## 
## Gia tri nho nhat:
print(iris.min(numeric_only=True))
## sepal_length    4.3
## sepal_width     2.0
## petal_length    1.0
## petal_width     0.1
## dtype: float64
print("\nGia tri lon nhat:")
## 
## Gia tri lon nhat:
print(iris.max(numeric_only=True))
## sepal_length    7.9
## sepal_width     4.4
## petal_length    6.9
## petal_width     2.5
## dtype: float64
counts = iris['species'].value_counts()
plt.bar(counts.index, counts.values)
plt.xlabel("Loai hoa")
plt.ylabel("So luong mau")
plt.title("So luong mau cua moi loai hoa Iris")
plt.show()