From 486e7622084d4d348b15617c3827639014a7e8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMSS3-ALSULAIMA=E2=80=9D?= <Mohammed3.Alsulaimani@live.uwe.ac.uk> Date: Wed, 8 Nov 2023 16:27:10 +0400 Subject: [PATCH] arithmetic mean --- UFCFVQ-15-M Programming Task 1 Template.ipynb | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/UFCFVQ-15-M Programming Task 1 Template.ipynb b/UFCFVQ-15-M Programming Task 1 Template.ipynb index ff1daaf..abd1451 100644 --- a/UFCFVQ-15-M Programming Task 1 Template.ipynb +++ b/UFCFVQ-15-M Programming Task 1 Template.ipynb @@ -19,10 +19,39 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The mean value is: 14.5\n" + ] + } + ], + "source": [ + "numbers_list = [\n", + " 29, 17, 28, 6, 14, 7, 4, 27, 21, 15,\n", + " 10, 16, 24, 26, 3, 11, 13, 8, 23, 9,\n", + " 0, 22, 12, 2, 18, 19, 5, 1, 20, 25\n", + "]\n", + "\n", + "# Find the average of a given list of numbers\n", + "\n", + "def arithmetic_mean(numbers):\n", + " total_sum = sum(numbers) \n", + " mean_value = total_sum / len(numbers) \n", + " return mean_value \n", + "\n", + "# Execute the function and save the resulting value\n", + "\n", + "mean_value = arithmetic_mean(numbers_list) \n", + "\n", + "# Display the average value(mean)\n", + "\n", + "print(f\"The mean value is: {mean_value}\") \n" + ] }, { "cell_type": "markdown", @@ -301,7 +330,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.9.6" }, "vscode": { "interpreter": { -- GitLab