diff --git a/Seth_A99501/day14.ipynb b/Seth_A99501/day14.ipynb new file mode 100644 index 00000000..027b4bc4 --- /dev/null +++ b/Seth_A99501/day14.ipynb @@ -0,0 +1,40 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "43.0 divided by 34.0 is 1.2647058823529411.\n" + ] + } + ], + "source": [ + "try:\n", + " #get the numerator and denominator from the user.\n", + " numerator = float(input(\"Enter the numerator: \"))\n", + " denominator = float(input(\"Enter the denominator: \"))\n", + " #divide the two numbers.\n", + " result = numerator / denominator\n", + "except ZeroDivisionError:\n", + " print(\"Division by zero is not allowed.\")\n", + "except ValueError:\n", + " print(\"Invalid input. Please enter correct numbers.\")\n", + "else:\n", + " print(f'{numerator} divided by {denominator} is {result}.')\n", + "\n" + ] + } + ], + "metadata": { + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}