Skip to content
Open
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
174 changes: 169 additions & 5 deletions Notebook1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,180 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "ca9af74b",
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10\n",
"34.4\n",
"hello\n"
]
}
],
"source": [
"# 3 variables of different data types \n",
"\n",
"a = 10\n",
"b = 34.4\n",
"c = \"hello\"\n",
"print(a)\n",
"print(b)\n",
"print(c)\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "1bfb78dd",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 2, 3, 4, 5]\n"
]
}
],
"source": [
"list = [1, 2, 3, 4, 5]\n",
"print(list) \n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "6d2bdb01",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'name': 'Yash', 'age': 20, 'city': 'New York'}\n"
]
}
],
"source": [
"dict = {\"name\": \"Yash\", \"age\": 20, \"city\": \"New York\"}\n",
"print(dict)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "8b4b5644",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"intiger variable a: 10\n",
"float variable b: 34.4\n",
"string variable c: hello\n",
"list variable list: [1, 2, 3, 4, 5]\n",
"dictionary variable dict: {'name': 'Yash', 'age': 20, 'city': 'New York'}\n"
]
}
],
"source": [
"# printing the variables declared \n",
"print(\"intiger variable a:\", a)\n",
"print(\"float variable b:\", b)\n",
"print(\"string variable c:\", c)\n",
"print(\"list variable list:\", list)\n",
"print(\"dictionary variable dict:\", dict)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "581138df",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{1, 2, 3, 4, 5}\n"
]
}
],
"source": [
"list1 = [1, 2, 3, 4, 5, 1, 2, 3]\n",
"print(set(list1))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "ea61f92f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{1, 2, 3, 4, 5, 'b', 'a', 'c'}\n",
"(1, 2, 3, 4, 5, 'b', 'a', 'c')\n",
"19.99\n"
]
}
],
"source": [
"list2 = [1, 2, 3, 4, 5 ,\"a\", \"b\", \"c\"]\n",
"print(set(list2))\n",
"print(tuple(set(list2)))\n",
"price_str = \"19.99\"\n",
"price_float = float(price_str)\n",
"print(price_float)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "085bdd85",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Welcome to the discount calculator!\n",
"total discount : 1050.0\n",
" total amount aften discount:5950.0\n"
]
}
],
"source": [
"# create a CLI based discount calculator \n",
"print(\"Welcome to the discount calculator!\")\n",
"amount = float(input(\"Enter the original amount: \"))\n",
"if amount > 500:\n",
" discount = 0.15\n",
"\n",
"elif amount > 1000:\n",
" discount = 0.10\n",
"\n",
"elif amount > 5000:\n",
" discount = 0.06\n",
"\n",
"else:\n",
" print(\"invalid amount\")\n",
" \n",
"\n",
"print(f\"total discount : {discount*amount}\\n total amount aften discount:{amount-discount*amount}\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "myenv",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -45,7 +209,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down
37 changes: 37 additions & 0 deletions notebook12feb.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "0e705c85",
"metadata": {},
"outputs": [],
"source": [
"# create a CLI based discount calculator \n",
"print(\"Welcome to the discount calculator!\")\n",
"amount = float(input(\"Enter the original amount: \"))\n",
"if amount > 500:\n",
" discount = 0.15\n",
"\n",
"elif amount > 1000:\n",
" discount = 0.10\n",
"\n",
"elif amount > 5000:\n",
" discount = 0.06\n",
"\n",
"else:\n",
" print(\"invalid amount\")\n",
" \n",
"\n",
"print(f\"total discount : {discount*amount}\\n total amount aften discount:{amount-discount*amount}\")"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading