Skip to content
Open

Main #20

Show file tree
Hide file tree
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
62 changes: 62 additions & 0 deletions Discount-calculator.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "eaa1b0a5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Total Discount: 25.0\n",
"Total amount after discount : 475.0\n"
]
}
],
"source": [
"amt = float(input(\"Enter the amt : \"))\n",
"\n",
"if amt >= 5000:\n",
" dis = 0.15\n",
"\n",
"elif amt >=1000:\n",
" dis = 0.10\n",
"\n",
"elif amt >=500:\n",
" dis = 0.05\n",
"\n",
"else:\n",
" print(\"Invalid amount\")\n",
"\n",
"discount = amt * dis\n",
"final_amt = amt - discount\n",
"\n",
"print(\"Total Discount:\",discount)\n",
"print(\"Total amount after discount : \" ,final_amt)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
106 changes: 106 additions & 0 deletions pyt_pragati_3rdyear-10-03-26.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 20,
"id": "ef72a8f1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"This is invalid number\n"
]
}
],
"source": [
"try:\n",
" num = int(input(\"Enter the number: \"))\n",
"\n",
" check = 10 / num \n",
"\n",
" if num % 2 == 0:\n",
" print(\"This is even number\")\n",
" else:\n",
" print(\"This is odd number\")\n",
"\n",
"except ZeroDivisionError:\n",
" print(\"Zero error: number cannot be zero\")\n",
"\n",
"except ValueError:\n",
" print(\"This is invalid number\")"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3135ee42",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Even number\n",
"\n",
"Final Report\n",
"Event Numbers: 1\n",
"odd Number: 0\n",
"Invalid input 0\n"
]
}
],
"source": [
"data = input(\"Enter the number : \").split()\n",
"\n",
"# counters\n",
"even_count = 0\n",
"odd_count = 0\n",
"invalid_count = 0\n",
"\n",
"for i in data:\n",
" try:\n",
" num = int(i)\n",
"\n",
" if num % 2 == 0:\n",
" print(\"Even number\")\n",
" even_count += 1\n",
" else:\n",
" print(\"Odd Number\")\n",
" odd_count +=1\n",
"\n",
" except:\n",
" print(i,\"is invalid, skipped\")\n",
" invalid_count += 1\n",
"\n",
"print(\"\\nFinal Report\")\n",
"print(\"Event Numbers:\",even_count)\n",
"print(\"odd Number:\",odd_count)\n",
"print(\"Invalid input\",invalid_count)\n",
" "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Empty file.
Empty file.
Loading