From 8f5c30984f847361e36fd86d384a427459cb84dd 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: Thu, 9 Nov 2023 07:12:10 +0400 Subject: [PATCH] min/max values --- UFCFVQ-15-M Programming Task 1 Template.ipynb | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/UFCFVQ-15-M Programming Task 1 Template.ipynb b/UFCFVQ-15-M Programming Task 1 Template.ipynb index 867e06c..197519b 100644 --- a/UFCFVQ-15-M Programming Task 1 Template.ipynb +++ b/UFCFVQ-15-M Programming Task 1 Template.ipynb @@ -120,11 +120,42 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The minimum value is: 0\n", + "The maximum value is: 29\n" + ] + } + ], "source": [ - "# add code here" + "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", + "# Create two functions that will allow you to find the min/max values, in a given list.\n", + "\n", + "def min_value(numbers):\n", + " return min(numbers)\n", + "\n", + "def max_value(numbers):\n", + " return max(numbers)\n", + "\n", + "# Find the min/max values within the list\n", + "\n", + "The_min_value = min_value(numbers_list)\n", + "The_max_value = max_value(numbers_list)\n", + "\n", + "# Display the result\n", + "\n", + "print(f\"The minimum value is: {The_min_value}\")\n", + "print(f\"The maximum value is: {The_max_value}\")\n" ] }, { -- GitLab