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
162 changes: 27 additions & 135 deletions Notebook1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,200 +2,92 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "73fb95c9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"7\n"
"110\n"
]
}
],
"source": [
"x = 3\n",
"y = 4\n",
"x = int(input(\"Enter a number: \"))\n",
"y = int(input(\"Enter another number: \"))\n",
"print(x + y)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f9658402",
"execution_count": 3,
"id": "ca9af74b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'int'>\n"
"[1, 2, 3, 3, 3, 'number', 'number', True]\n",
"{1, 2, 3, 'number'}\n",
"[1, 2, 3, 'number']\n"
]
}
],
"source": [
"print(type(y)) # Output: <class 'int'>"
"list1 = [1, 2, 3, 3, 3, \"number\", \"number\", True]\n",
"print(list1)\n",
"print(set(list1))\n",
"print(list(set(list1)))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e759f74e",
"execution_count": 19,
"id": "eb8566c6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n"
]
}
],
"source": [
"list1 = [1, 2, 3, 4, 5]\n",
"print(list1[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4590340e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'coconut'"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"list2 = [\"apple\", \"banana\", \"cherry\", \"coconut\", \"grape\"]\n",
"list2[3]"
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7f877009",
"execution_count": 23,
"id": "8001adbc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'It is a collection of items which can be of different data types. It is ordered, \\nchangeable, and allows duplicate values. \\nLists are defined using square brackets [] and items are separated by commas.'"
"Timestamp('2026-02-12 00:00:00')"
]
},
"execution_count": 14,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#list is also a type of data in Python.\n",
"'''Definition of a List: It is a collection of items which can be of different data types. It is ordered, \n",
"changeable, and allows duplicate values. \n",
"Lists are defined using square brackets [] and items are separated by commas.'''"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e5d50776",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 is of type <class 'int'>\n",
"3.14 is of type <class 'float'>\n",
"Hello is of type <class 'str'>\n",
"True is of type <class 'bool'>\n",
"[1, 2, 3] is of type <class 'list'>\n",
"{'name': 'Alice', 'age': 30} is of type <class 'dict'>\n",
"(1, 2) is of type <class 'tuple'>\n",
"{1, 2, 3} is of type <class 'set'>\n"
]
}
],
"source": [
"import numpy as np\n",
"all_types = [1, 3.14, \"Hello\", True, [1, 2, 3], {\"name\": \"Alice\", \"age\": 30}, (1, 2), {1, 2, 3}]\n",
"\n",
"#print(type(all_types[-1]))\n",
"#all_types[5][\"name\"]\n",
"\n",
"def tell_list_item_type(lst):\n",
" for item in lst:\n",
" print(f\"{item} is of type {type(item)}\")\n",
"\n",
"tell_list_item_type(all_types)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a061d70d",
"metadata": {},
"outputs": [],
"source": [
"list3 = [1, 2, 2, 24, 5, True, 'g']\n",
"new_set = set(list3)\n",
"#print(new_set)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fbac0ecd",
"metadata": {},
"outputs": [],
"source": [
"#A set is a collection which is unordered, unchangeable*, and unindexed. In Python, sets are written with curly brackets."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "43c09a96",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 is of type <class 'int'>\n",
"2 is of type <class 'int'>\n",
"2 is of type <class 'int'>\n",
"24 is of type <class 'int'>\n",
"5 is of type <class 'int'>\n",
"True is of type <class 'bool'>\n",
"g is of type <class 'str'>\n"
]
}
],
"source": [
"tell_list_item_type(list3)"
"today_date = \"2026-02-12\"\n",
"date=pd.to_datetime(today_date)\n",
"date"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4c5c9023",
"id": "f132dab9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "myenv",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -209,7 +101,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down
73 changes: 73 additions & 0 deletions Notebook2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"id": "1b3a412d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"----- BILL SUMMARY -----\n",
"Your Amount is Rs. 500.00\n",
"Your Discount is 5%\n",
"Your Discount Amount is Rs. 25.00\n",
"Your Final Amount is Rs. 475.00\n"
]
}
],
"source": [
"try:\n",
" amount = float(input(\"Enter Amount: \"))\n",
"\n",
" if amount <= 0:\n",
" print(\"Amount must be greater than 0\")\n",
"\n",
" elif amount <= 1000:\n",
" discount = 5\n",
" elif amount <= 10000:\n",
" discount = 10\n",
" elif amount <= 20000:\n",
" discount = 15\n",
" else:\n",
" discount = 20\n",
"\n",
" discount_amount = amount * (discount / 100)\n",
" final_amount = amount - discount_amount\n",
"\n",
" print(\"\\n----- BILL SUMMARY -----\")\n",
" print(f\"Your Amount is Rs. {amount:.2f}\")\n",
" print(f\"Your Discount is {discount}%\")\n",
" print(f\"Your Discount Amount is Rs. {discount_amount:.2f}\")\n",
" print(f\"Your Final Amount is Rs. {final_amount:.2f}\")\n",
"\n",
"except ValueError:\n",
" print(\"Please enter a valid numeric amount\")\n"
]
}
],
"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
}