Open carmelo-cyber opened 1 year ago
import numpy as np
numbers = [1, 2, 3, 4, 5]
sum = np.sum(numbers)
mean = np.mean(numbers)
std = np.std(numbers)
print(f"Sum: {sum}") print(f"Mean: {mean:.2f}") print(f"Standard deviation: {std:.2f}")
Import the necessary libraries
import numpy as np
Define the array of numbers
numbers = [1, 2, 3, 4, 5]
Calculate the sum of the array
sum = np.sum(numbers)
Calculate the mean of the array
mean = np.mean(numbers)
Calculate the standard deviation of the array
std = np.std(numbers)
Print the results
print(f"Sum: {sum}") print(f"Mean: {mean:.2f}") print(f"Standard deviation: {std:.2f}")