Skip to content

day14 #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Seth_A99501/day14.ipynb
Original file line number Diff line number Diff line change
@@ -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
}