diff --git a/UFCFVQ-15-M Programming Task 1 Template.ipynb b/UFCFVQ-15-M Programming Task 1 Template.ipynb index abd1451759829caf44620f3627725aa1c946f847..867e06c716315e0fd47467ef261cd9c38f7996e5 100644 --- a/UFCFVQ-15-M Programming Task 1 Template.ipynb +++ b/UFCFVQ-15-M Programming Task 1 Template.ipynb @@ -70,10 +70,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The standard deviation is: 8.65544144839919\n" + ] + } + ], + "source": [ + "def find_std(numbers, mean):\n", + "\n", + "# Find the variance by averaging the squared differences, from the mean.\n", + "# Then take the root to obtain the standard deviation.\n", + "\n", + " std_value = (sum([(x - mean) ** 2 for x in numbers]) / len(numbers)) ** 0.5\n", + " return (std_value)\n", + "\n", + "# Determine the mean of the numbers_list using the function we defined earlier.\n", + "\n", + "mean_value = arithmetic_mean(numbers_list)\n", + "\n", + "# Calculate the deviation using the find_std function and the mean_value.\n", + "\n", + "std_value = find_std(numbers_list, mean_value)\n", + "\n", + "# Print the calculated standard deviation\n", + "\n", + "print(f\"The standard deviation is: {std_value}\")\n" + ] }, { "cell_type": "markdown",