From 4f8fab2a6e462866161409dacbd9113a6b75a446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Sand=20Jensen?= <bjje@dtu.dk> Date: Mon, 10 Feb 2025 13:59:39 +0100 Subject: [PATCH] minior namefix --- .../02450Toolbox_Python/Scripts/ex2_1_2.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 exercises/02450Toolbox_Python/Scripts/ex2_1_2.py diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex2_1_2.py new file mode 100644 index 0000000..dea5b3f --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_1_2.py @@ -0,0 +1,19 @@ +# exercise 2.1.1 +import numpy as np + +x = np.array([-0.68, -2.11, 2.39, 0.26, 1.46, 1.33, 1.03, -0.41, -0.33, 0.47]) + +# Compute values +mean_x = x.mean() +std_x = x.std(ddof=1) # ddof: Delta Degrees of freedom +median_x = np.median(x) +range_x = x.max() - x.min() + +# Display results +print("Vector:", x) +print("Mean:", mean_x) +print("Standard Deviation:", std_x) +print("Median:", median_x) +print("Range:", range_x) + +print("Ran Exercise 2.1.1") \ No newline at end of file -- GitLab