From ea8aaf4dc3975539d9a4972f9cac2ab9b17dc54b Mon Sep 17 00:00:00 2001 From: bhumikakadbe Date: Wed, 11 Mar 2026 10:25:15 +0530 Subject: [PATCH 1/4] Added classwork of 9/10 march 26 --- Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb diff --git a/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb b/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb new file mode 100644 index 0000000..e69de29 From 4f10eee85c3d9ae2ed7ce1318ae03c64faa41921 Mon Sep 17 00:00:00 2001 From: bhumikakadbe Date: Wed, 11 Mar 2026 10:30:07 +0530 Subject: [PATCH 2/4] Added Task(try-except) of 10mar26 --- tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb diff --git a/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb b/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb new file mode 100644 index 0000000..e69de29 From b6927f0decf9391f4db3160329307c6ce9704ace Mon Sep 17 00:00:00 2001 From: bhumikakadbe Date: Wed, 11 Mar 2026 17:00:35 +0530 Subject: [PATCH 3/4] Added the files of tasks --- Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb | 0 Tasks/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb | 114 +++++++++ .../Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb | 240 ++++++++++++++++++ .../Pyt_bhumika_kadbe_3rdyr_11mar26.ipynb | 87 +++++++ tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb | 0 5 files changed, 441 insertions(+) delete mode 100644 Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb create mode 100644 Tasks/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb create mode 100644 classwork/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb create mode 100644 classwork/Pyt_bhumika_kadbe_3rdyr_11mar26.ipynb delete mode 100644 tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb diff --git a/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb b/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb deleted file mode 100644 index e69de29..0000000 diff --git a/Tasks/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb b/Tasks/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb new file mode 100644 index 0000000..d2eeaf2 --- /dev/null +++ b/Tasks/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb @@ -0,0 +1,114 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 7, + "id": "f0b07315", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3 g\n", + "Error of value: Please enter a number not value\n" + ] + } + ], + "source": [ + "#input strings\n", + "a=input(\"Enter a num:\" )\n", + "b=input(\"Enter a num:\" )\n", + "print(a,b)\n", + "\n", + "try:\n", + " division = int(a) / int(b)\n", + " print(\"Division is : \", division)\n", + "except ZeroDivisionError:\n", + " print(\"Error of 0: Division by 0 is not allowed\")\n", + "except ValueError:\n", + " print(\"Error of value: Please enter a number not value\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "eb82f56d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['3', 'd', '4', 'r', '6', '7', 'y', 'u']\n", + "3 -> Odd number\n", + "d -> Invalid input detected\n", + "4 -> Even number\n", + "r -> Invalid input detected\n", + "6 -> Even number\n", + "7 -> Odd number\n", + "y -> Invalid input detected\n", + "u -> Invalid input detected\n", + "\n", + "result:\n", + "Total valid numbers: 4\n", + "Total invalid inputs: 4\n" + ] + } + ], + "source": [ + "# Python program to process a sequence of numbers\n", + "\n", + "# Ask user for input\n", + "user_input = input(\"Enter numbers separated by spaces: \")\n", + "\n", + "# Split input into list\n", + "items = user_input.split()\n", + "print(items)\n", + "\n", + "# Initialize counters\n", + "valid_count = 0\n", + "invalid_count = 0\n", + "\n", + "# Iterate through each item\n", + "for item in items:\n", + " try:#using try-except\n", + " num = int(item) # converting to integer\n", + " valid_count += 1\n", + " if num % 2 == 0:\n", + " print(f\"{num} -> Even number\")\n", + " else:\n", + " print(f\"{num} -> Odd number\")\n", + " except ValueError:\n", + " invalid_count += 1\n", + " print(f\"{item} -> Invalid input detected\")\n", + "\n", + "# Final result\n", + "print(\"\\nresult:\")\n", + "print(f\"Total valid numbers: {valid_count}\")\n", + "print(f\"Total invalid inputs: {invalid_count}\") " + ] + } + ], + "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 +} diff --git a/classwork/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb b/classwork/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb new file mode 100644 index 0000000..742cfa9 --- /dev/null +++ b/classwork/Pyt_Bhumika_Kadbe_3rdyr_10Mar26.ipynb @@ -0,0 +1,240 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "e5b7ef82", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['English', 'Maths', 'Science', 'Marathi', 'Hindi', 'Sanskrit', 'Maths']\n", + "['English', 'Maths', 'Science', 'Marathi', 'Hindi', 'Sanskrit', 'Maths', 'Computer']\n", + "['English', 'Maths', 'History', 'Science', 'Marathi', 'Hindi', 'Sanskrit', 'Maths', 'Computer']\n", + "9\n", + "['English', 'Maths', 'Science', 'Marathi', 'Hindi', 'Sanskrit', 'Maths', 'Computer']\n", + "2\n", + "['English', 'Science', 'Marathi', 'Hindi', 'Sanskrit', 'Maths', 'Computer']\n", + "[]\n", + "[12.3, 4.5, 6.7, 8.9, 2.0, 3.4, 5.6, 1.0, 3.56, 7.8]\n", + "[1.0, 2.0, 3.4, 3.56, 4.5, 5.6, 6.7, 7.8, 8.9, 12.3]\n" + ] + } + ], + "source": [ + "# perform append() on list --->inseert at end without index no\n", + "list_sub = [\"English\", \"Maths\", \"Science\", \"Marathi\", \"Hindi\", \"Sanskrit\", \"Maths\"]\n", + "print(list_sub)\n", + "list_sub.append(\"Computer\")\n", + "print(list_sub)\n", + "\n", + "#perform insert() on list---->insert with index no\n", + "list_sub.insert(2, \"History\")\n", + "print(list_sub)\n", + "\n", + "#checking len of list\n", + "print(len(list_sub))\n", + "\n", + "#perform pop() on list--->remove last element from list (cannot use the values only index no)\n", + "list_sub.pop(2)\n", + "print(list_sub)\n", + "\n", + "#count\n", + "print(list_sub.count(\"Maths\"))\n", + "\n", + "#perform remove() on list ---> remove elements with values\n", + "list_sub.remove(\"Maths\")\n", + "print(list_sub)\n", + "\n", + "#perform clear() on list---> remove all elements from list\n", + "list_sub.clear()\n", + "print(list_sub)\n", + "\n", + "#making new list \n", + "ls=[12.3, 4.5, 6.7, 8.9, 2.0, 3.4, 5.6, 1.0, 3.56, 7.8]\n", + "print(ls)\n", + "ls.sort()\n", + "print(ls) " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "9d0e1f8f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('Apple', 'Banana', 'Grapes', 'Orange', 'Pineapple', 'Cherry', 'Strawberry')\n", + "7\n", + "Grapes\n", + "2\n", + "1\n", + "['Apple', 'Banana', 'Grapes', 'Orange', 'Pineapple', 'Cherry', 'Strawberry']\n" + ] + } + ], + "source": [ + "# performing Different Functions in Tuple\n", + "\n", + "# making new tuple\n", + "tup = (\"Apple\", \"Banana\", \"Grapes\", \"Orange\", \"Pineapple\", \"Cherry\", \"Strawberry\")\n", + "print(tup)\n", + "\n", + "# checking length of tuple\n", + "print(len(tup))\n", + "\n", + "# accessing tuple using index number\n", + "print(tup[2])\n", + "\n", + "# finding index of element in tuple\n", + "print(tup.index(\"Grapes\"))\n", + "\n", + "# performing count() on tuple\n", + "print(tup.count(\"Grapes\"))\n", + "\n", + "# converting tuple into list\n", + "tup_list = list(tup)\n", + "print(tup_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "231ebd8e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'Delhi', 'Nagpur', 'Nashik', 'Amaravati', 'Mumbai', 'Pune'}\n", + "{'Delhi', 'Nagpur', 'Bangalore', 'Nashik', 'Amaravati', 'Mumbai', 'Pune'}\n", + "{'Delhi', 'Bangalore', 'Amaravati', 'Nagpur', 'Hyderabad', 'Pune', 'Mumbai', 'Chandrapur', 'Nashik'}\n", + "9\n", + "{'Bangalore', 'Amaravati', 'Nagpur', 'Hyderabad', 'Pune', 'Mumbai', 'Chandrapur', 'Nashik'}\n", + "{'Bangalore', 'Amaravati', 'Nagpur', 'Hyderabad', 'Pune', 'Mumbai', 'Chandrapur'}\n", + "set()\n" + ] + } + ], + "source": [ + "# Performing Different function on sets\n", + "\n", + "st = {\"Nagpur\", \"Amaravati\", \"Mumbai\", \"Pune\", \"Nashik\", \"Delhi\"}\n", + "print(st)\n", + "\n", + "# adding element in set --> add anywhere because sets are unordered\n", + "st.add(\"Bangalore\")\n", + "print(st)\n", + "\n", + "# adding multiple elements\n", + "st.update([\"Hyderabad\", \"Chandrapur\"])\n", + "print(st)\n", + "\n", + "# checking length\n", + "print(len(st))\n", + "\n", + "# pop an element\n", + "st.pop()\n", + "print(st)\n", + "\n", + "# removing element\n", + "st.remove(\"Nashik\")\n", + "print(st)\n", + "\n", + "# clearing set\n", + "st.clear()\n", + "print(st)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "24e755c7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'Bhumika', 'age': 19, 'course': 'CSE', 'city': 'Nagpur', 'lazy': 'True'}\n", + "{'name': 'Bhumika', 'age': 19, 'course': 'CSE', 'city': 'Nagpur', 'lazy': 'True', 'college': 'JIT'}\n", + "{'name': 'Bhumika', 'age': 20, 'course': 'CSE', 'city': 'Nagpur', 'lazy': 'True', 'college': 'JIT'}\n", + "Bhumika\n", + "6\n", + "{'name': 'Bhumika', 'age': 20, 'city': 'Nagpur', 'lazy': 'True', 'college': 'JIT'}\n", + "dict_keys(['name', 'age', 'city', 'lazy', 'college'])\n", + "dict_values(['Bhumika', 20, 'Nagpur', 'True', 'JIT'])\n", + "{}\n" + ] + } + ], + "source": [ + "# creating dictionary\n", + "dict1 = {\n", + " \"name\": \"Bhumika\",\n", + " \"age\": 19,\n", + " \"course\": \"CSE\",\n", + " \"city\": \"Nagpur\",\n", + " \"lazy\": \"True\"\n", + "}\n", + "\n", + "print(dict1)\n", + "\n", + "# add new key\n", + "dict1[\"college\"] = \"JIT\"\n", + "print(dict1)\n", + "\n", + "# update value\n", + "dict1[\"age\"] = 20\n", + "print(dict1)\n", + "\n", + "# access value\n", + "print(dict1[\"name\"])\n", + "\n", + "# length\n", + "print(len(dict1))\n", + "\n", + "# remove key\n", + "dict1.pop(\"course\")\n", + "print(dict1)\n", + "\n", + "# get all keys\n", + "print(dict1.keys())\n", + "\n", + "# get all values\n", + "print(dict1.values())\n", + "\n", + "# clear dictionary\n", + "dict1.clear()\n", + "print(dict1)" + ] + } + ], + "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 +} diff --git a/classwork/Pyt_bhumika_kadbe_3rdyr_11mar26.ipynb b/classwork/Pyt_bhumika_kadbe_3rdyr_11mar26.ipynb new file mode 100644 index 0000000..698bc0e --- /dev/null +++ b/classwork/Pyt_bhumika_kadbe_3rdyr_11mar26.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "af93fc9d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[78, 40, 92, 34, 67, 88, 53, 41, 76, 29, 64, 81, 39, 55, 72, 90, 47, 68, 33, 84, 0, -5, 100, 40, 75]\n", + "first 10 scores [78, 40, 92, 34, 67, 88, 53, 41, 76, 29]\n", + "last five scores [0, -5, 100, 40, 75]\n", + "scores after 2 interval: [40, 34, 88, 41, 29, 81, 55, 90, 68, 84, -5, 40]\n", + "Passed Students before adding 5 marks:: [78, 40, 92, 67, 88, 53, 41, 76, 64, 81, 55, 72, 90, 47, 68, 84, 100, 40, 75]\n", + "Failed Students before adding 5 marks: [34, 29, 39, 33, 0, -5]\n", + "Increased Marks list: [83, 45, 97, 39, 72, 93, 58, 46, 81, 34, 69, 86, 44, 60, 77, 95, 52, 73, 38, 89, 5, 0, 105, 45, 80]\n", + "Top Students More than 75 marks: [83, 97, 93, 81, 86, 77, 95, 89, 105, 80]\n" + ] + } + ], + "source": [ + "#creating list name scores\n", + "scores = [78, 40, 92, 34, 67, 88, 53, 41, 76, 29, 64, 81, 39, 55, 72, 90, 47, 68, 33, 84, 0, -5, 100, 40, 75]\n", + "print(scores)\n", + "\n", + "l1=scores[0:10]\n", + "print(\"first 10 scores\", l1)\n", + "\n", + "l2=scores[-5:]\n", + "print(\"last five scores\", l2)\n", + "\n", + "l3=scores[1::2]\n", + "print(\"scores after 2 interval: \", l3)\n", + "\n", + "pass_students =[]\n", + "failed_students =[]\n", + "for i in scores:\n", + " if(i>=40):\n", + " pass_students.append(i)\n", + " else:\n", + " failed_students.append(i)\n", + "\n", + "print(\"Passed Students before adding 5 marks::\", pass_students)\n", + "print(\"Failed Students before adding 5 marks: \", failed_students)\n", + "\n", + "#making new csire list increase by 5\n", + "increase = []\n", + "for i in scores:\n", + " i = i+5\n", + " increase.append(i)\n", + "\n", + "print(\"Increased Marks list: \",increase)\n", + "\n", + "only_top =[]\n", + "for i in increase:\n", + " if(i>=75):\n", + " only_top.append(i)\n", + "print(\"Top Students More than 75 marks:\",only_top)\n", + "\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 +} diff --git a/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb b/tsk_Bhumika_kadbe_3rdyr_10mar26.ipynb deleted file mode 100644 index e69de29..0000000 From ac48a1fabbce734feadf80aec99c32ddf533489e Mon Sep 17 00:00:00 2001 From: bhumikakadbe Date: Mon, 16 Mar 2026 12:11:54 +0530 Subject: [PATCH 4/4] set dictionary task --- Notebook1.ipynb | 6 +- .../Pyt_Bhumika_Kadbe_3rdyr_12Mar26.ipynb | 354 ++++++++++++++++++ .../Pyt_Bhumika_kadbe_3rdye_13mar26.ipynb | 275 ++++++++++++++ 3 files changed, 632 insertions(+), 3 deletions(-) create mode 100644 classwork/Pyt_Bhumika_Kadbe_3rdyr_12Mar26.ipynb create mode 100644 classwork/Pyt_Bhumika_kadbe_3rdye_13mar26.ipynb diff --git a/Notebook1.ipynb b/Notebook1.ipynb index f080647..ccaefba 100644 --- a/Notebook1.ipynb +++ b/Notebook1.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "73fb95c9", "metadata": {}, "outputs": [ @@ -31,7 +31,7 @@ ], "metadata": { "kernelspec": { - "display_name": "myenv", + "display_name": "py101 (3.13.9)", "language": "python", "name": "python3" }, @@ -45,7 +45,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.7" + "version": "3.13.9" } }, "nbformat": 4, diff --git a/classwork/Pyt_Bhumika_Kadbe_3rdyr_12Mar26.ipynb b/classwork/Pyt_Bhumika_Kadbe_3rdyr_12Mar26.ipynb new file mode 100644 index 0000000..a13c5ba --- /dev/null +++ b/classwork/Pyt_Bhumika_Kadbe_3rdyr_12Mar26.ipynb @@ -0,0 +1,354 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "98fe8a8b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Days 1 sales: 1800\n", + "Days 2 sales: 1200\n", + "Days 3 sales: 900\n", + "Days 4 sales: 1150\n", + "Days 5 sales: 2560\n", + "Days 6 sales: 1890\n", + "Days 7 sales: 2200\n", + "The total sum of sales is: 11700\n" + ] + } + ], + "source": [ + "sales = [\"1800\", \"1200\", \"900\", \"1150\",\"2560\", \"1890\", \"2200\"]\n", + "valid_input =[]\n", + "total =0\n", + "day =1 \n", + "for i in sales:\n", + " i = int(i)\n", + " valid_input.append(i)\n", + " print(f\"Days {day} sales: {i}\")\n", + " day +=1\n", + " total += i\n", + "print(f\"The total sum of sales is: {total}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "3fe90837", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "****\n", + "****\n", + "****\n", + "****\n" + ] + } + ], + "source": [ + "r =int(input(\"Enter a num: \"))\n", + "i=1\n", + "for i in range(r):\n", + " for j in range(r):\n", + " print(\"*\", end=\"\")\n", + " print()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "0cb5d446", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "*\n", + "**\n", + "***\n", + "****\n" + ] + } + ], + "source": [ + "for i in range(r+1):\n", + " for j in range(i):\n", + " print(\"*\",end=\"\")\n", + " print()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "aeb049b4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "01234\n", + "01234\n", + "01234\n", + "01234\n", + "01234\n" + ] + } + ], + "source": [ + "for i in range(r+1):\n", + " for j in range(r+1):\n", + " print(j,end=\"\")\n", + " print()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "f10490af", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('ORD001', 'C101', 'Laptop', 1200)\n", + "('ORD002', 'C102', 'Phone', 800)\n", + "('ORD003', 'C101', 'Laptop', 1200)\n", + "('ORD004', 'C103', 'Tablet', 600)\n", + "('ORD005', 'C104', 'Phone', 800)\n", + "('ORD006', 'C102', 'Headphones', 150)\n", + "('ORD007', 'C105', 'Laptop', 1200)\n", + "('ORD003', 'C101', 'Laptop', 1200)\n", + "('ORD008', 'C106', 'Tablet', 600)\n", + "('ORD009', 'C101', 'Phone', 800)\n", + "Total no of orders: 10\n" + ] + } + ], + "source": [ + "orders = [\n", + "(\"ORD001\", \"C101\", \"Laptop\", 1200),\n", + "(\"ORD002\", \"C102\", \"Phone\", 800),\n", + "(\"ORD003\", \"C101\", \"Laptop\", 1200),\n", + "(\"ORD004\", \"C103\", \"Tablet\", 600),\n", + "(\"ORD005\", \"C104\", \"Phone\", 800),\n", + "(\"ORD006\", \"C102\", \"Headphones\", 150),\n", + "(\"ORD007\", \"C105\", \"Laptop\", 1200),\n", + "(\"ORD003\", \"C101\", \"Laptop\", 1200), # duplicate order\n", + "(\"ORD008\", \"C106\", \"Tablet\", 600),\n", + "(\"ORD009\", \"C101\", \"Phone\", 800)\n", + "]\n", + "\n", + "#for printing the order list\n", + "for i in orders:\n", + " print(i)\n", + "print(\"Total no of orders: \",len(orders))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "2579a72f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('ORD005', 'C104', 'Phone', 800)\n", + "('ORD004', 'C103', 'Tablet', 600)\n", + "('ORD003', 'C101', 'Laptop', 1200)\n", + "('ORD008', 'C106', 'Tablet', 600)\n", + "('ORD002', 'C102', 'Phone', 800)\n", + "('ORD001', 'C101', 'Laptop', 1200)\n", + "('ORD007', 'C105', 'Laptop', 1200)\n", + "('ORD006', 'C102', 'Headphones', 150)\n", + "('ORD009', 'C101', 'Phone', 800)\n", + "Total Unique Records: 9\n" + ] + } + ], + "source": [ + "#remove duplicate records\n", + "unique_records = set(orders) \n", + "for record in unique_records:\n", + " print(record)\n", + " \n", + "#printing the number of unique records\n", + "print(\"Total Unique Records: \",len(unique_records))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "c216f308", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Unique Customers: {'C103', 'C102', 'C104', 'C105', 'C106', 'C101'}\n" + ] + } + ], + "source": [ + "#idedentify unique customers\n", + "unique_customers = set()\n", + "for order in orders:\n", + " unique_customers.add(order[1])\n", + "print(\"Unique Customers: \",unique_customers)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "f2e52f0b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Product are : ['Laptop', 'Phone', 'Laptop', 'Tablet', 'Phone', 'Headphones', 'Laptop', 'Laptop', 'Tablet', 'Phone']\n", + "10\n", + "Unique Product Names: {'Tablet', 'Phone', 'Laptop', 'Headphones'}\n", + "4\n" + ] + } + ], + "source": [ + "#extract product name using list comprehension\n", + "product_names = [order[2] for order in orders]\n", + "print(\"Product are : \", product_names)\n", + "print(len(product_names))\n", + "\n", + "unique_product_name = set(product_names)\n", + "print(\"Unique Product Names: \", unique_product_name)\n", + "print(len(unique_product_name))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "8329d000", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Sales for each product: {'Laptop': 4, 'Phone': 3, 'Tablet': 2, 'Headphones': 1}\n" + ] + } + ], + "source": [ + "#count how many different products are sold\n", + "total_product_sales = {}\n", + "for order in orders:\n", + " if order[2] in total_product_sales:\n", + " total_product_sales[order[2]] += 1\n", + " else:\n", + " total_product_sales[order[2]] = 1\n", + "\n", + "print(\"Total Sales for each product: \", total_product_sales)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "77a8db7c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Revenue for each product: {'Laptop': 4800, 'Phone': 2400, 'Tablet': 1200, 'Headphones': 150}\n" + ] + } + ], + "source": [ + "#order[2] is the product name and order[3] is revenue\n", + "#print unique product with revenue\n", + "total_product_revenue = {}\n", + "for order in orders:\n", + " product_name = order[2]\n", + " revenue = order[3]\n", + " if product_name in total_product_revenue:\n", + " total_product_revenue[product_name] += revenue\n", + " else:\n", + " total_product_revenue[product_name] = revenue\n", + "print(\"Total Revenue for each product: \", total_product_revenue)\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "4f554008", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Orders for each customer: {'C101': 4, 'C102': 2, 'C103': 1, 'C104': 1, 'C105': 1, 'C106': 1}\n", + "Customer with maximum orders: ['C101']\n" + ] + } + ], + "source": [ + "#customers with no of orders\n", + "customer_order_count = {}\n", + "for order in orders:\n", + " customer_id = order[1]\n", + " if customer_id in customer_order_count:\n", + " customer_order_count[customer_id] += 1\n", + " else:\n", + " customer_order_count[customer_id] = 1\n", + "\n", + "print(\"Total Orders for each customer: \", customer_order_count)\n", + "\n", + "#customer with maiximum orders\n", + "max_orders = max(customer_order_count.values())\n", + "top_customer = []\n", + "for customer, count in customer_order_count.items():\n", + " if count == max_orders:\n", + " top_customer.append(customer)\n", + "print(\"Customer with maximum orders: \", top_customer)" + ] + } + ], + "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 +} diff --git a/classwork/Pyt_Bhumika_kadbe_3rdye_13mar26.ipynb b/classwork/Pyt_Bhumika_kadbe_3rdye_13mar26.ipynb new file mode 100644 index 0000000..3d7e217 --- /dev/null +++ b/classwork/Pyt_Bhumika_kadbe_3rdye_13mar26.ipynb @@ -0,0 +1,275 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "b28d8e35", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['U101', 'U102', 'U103', 'U101', 'U104', 'U102', 'U105', 'U103']\n", + "8\n", + "Unique Visitors: {'U101', 'U105', 'U103', 'U104', 'U102'}\n", + "Number of Unique Visitors: 5\n", + "List of Unique IDs: ['U101', 'U105', 'U103', 'U104', 'U102']\n" + ] + } + ], + "source": [ + "day_visits = [\"U101\",\"U102\",\"U103\",\"U101\",\"U104\",\"U102\",\"U105\",\"U103\"]\n", + "print(day_visits)\n", + "print(len(day_visits))\n", + "\n", + "unique_visitors = set(day_visits)\n", + "print(\"Unique Visitors: \", unique_visitors)\n", + "print(\"Number of Unique Visitors:\", len(unique_visitors))\n", + "\n", + "list_of_unique_ids = list(unique_visitors)\n", + "print(\"List of Unique IDs: \", list_of_unique_ids)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8e9340e8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Laptop', 'Phone', 'Laptop', 'Tablet', 'Phone', 'Laptop']\n", + "6\n", + "{'Laptop': 3, 'Phone': 2, 'Tablet': 1}\n", + "Laptop: 3\n", + "Phone: 2\n", + "Tablet: 1\n", + "Most Purchased Product: Laptop\n" + ] + } + ], + "source": [ + "#Create a dictionary storing product purchase frequency.\n", + "purchases = [\"Laptop\",\"Phone\",\"Laptop\",\"Tablet\",\"Phone\",\"Laptop\"]\n", + "print(purchases)\n", + "print(len(purchases))\n", + "\n", + "frequency = {}\n", + "for purchase in purchases:\n", + " if purchase in frequency:\n", + " frequency[purchase] += 1\n", + " else:\n", + " frequency[purchase] = 1\n", + "print(frequency)\n", + "\n", + "# printing the dictionary\n", + "for product, count in frequency.items():\n", + " print(f\"{product}: {count}\")\n", + " \n", + "# identify the most purchased product\n", + "most_purchased_product = max(frequency, key=frequency.get)\n", + "print(\"Most Purchased Product: \", most_purchased_product)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "804af115", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Common Visitors: ['U103', 'U104']\n", + "Unique Visitors: ['U101', 'U102', 'U105', 'U106']\n", + "Only in day1 : ['U101', 'U102']\n" + ] + } + ], + "source": [ + "day1 = [\"U101\",\"U102\",\"U103\",\"U104\"]\n", + "day2 = [\"U103\",\"U104\",\"U105\",\"U106\"]\n", + "\n", + "#identify common visitor\n", + "common_visitor =[]\n", + "for i in day1:\n", + " if i in day2:\n", + " common_visitor.append(i)\n", + "print(\"Common Visitors: \", common_visitor)\n", + "\n", + "unique_visitors =[]\n", + "for i in day1:\n", + " if i in day2:\n", + " continue\n", + " else:\n", + " unique_visitors.append(i) \n", + "\n", + "for i in day2:\n", + " if i in day1:\n", + " continue\n", + " else:\n", + " unique_visitors.append(i)\n", + "\n", + "print(\"Unique Visitors: \", unique_visitors)\n", + "\n", + "only_day1_visitors = []\n", + "for i in day1:\n", + " if i in day2:\n", + " continue\n", + " else:\n", + " only_day1_visitors.append(i) \n", + "print(\"Only in day1 : \", only_day1_visitors)\n", + " \n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "8dbb9201", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Department Count: {'Data Analyst': 2, 'Data Engineer': 2, 'ML Engineer': 1}\n", + "Data Analyst: 2\n", + "Data Engineer: 2\n", + "ML Engineer: 1\n", + "Department with the highest number of employees: Data Analyst\n" + ] + } + ], + "source": [ + "employees = [\n", + "(\"E101\",\"Data Analyst\"),\n", + "(\"E102\",\"Data Engineer\"),\n", + "(\"E103\",\"Data Analyst\"),\n", + "(\"E104\",\"ML Engineer\"),\n", + "(\"E105\",\"Data Engineer\")\n", + "]\n", + "# Create a dictionary to count the number of employees in each department\n", + "department_count = {}\n", + "for emp_id, department in employees:\n", + " if department in department_count:\n", + " department_count[department] += 1\n", + " else:\n", + " department_count[department] = 1\n", + "print(\"Department Count: \", department_count)\n", + "\n", + "#for no ofemploye per department\n", + "for department, count in department_count.items():\n", + " print(f\"{department}: {count}\")\n", + " \n", + "#identify trhe department with highest no of employees\n", + "most_employees_department = max(department_count, key=department_count.get)\n", + "print(\"Department with the highest number of employees: \", most_employees_department)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "c8a7cf4c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Unique Skills: {'SQL', 'Python', 'Tableau', 'Spark', 'Machine Learning'}\n", + "5\n", + "Sorted Skills: ['Machine Learning', 'Python', 'SQL', 'Spark', 'Tableau']\n" + ] + } + ], + "source": [ + "team_skills = {\n", + "\"Alice\": [\"Python\",\"SQL\",\"Tableau\"],\n", + "\"Bob\": [\"Python\",\"Spark\",\"SQL\"],\n", + "\"Charlie\": [\"Python\",\"Machine Learning\",\"SQL\"]\n", + "}\n", + "\n", + "#unique set of skills\n", + "unique_skills = set()\n", + "for skills in team_skills.values():\n", + " unique_skills.update(skills)\n", + "print(\"Unique Skills: \", unique_skills)\n", + "print(len(unique_skills))\n", + "\n", + "#print the skill list in alphabetical order\n", + "sorted_skills = sorted(unique_skills)\n", + "print(\"Sorted Skills: \", sorted_skills)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "896509fa", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Revenue by Product: {'Laptop': 2400, 'Phone': 1600, 'Tablet': 600}\n", + "Products sorted by name: [('Tablet', 600), ('Phone', 800), ('Phone', 800), ('Laptop', 1200), ('Laptop', 1200)]\n", + "Highest Revenue Generating Product: Laptop\n" + ] + } + ], + "source": [ + "sales = [\n", + "(\"Laptop\",1200),\n", + "(\"Phone\",800),\n", + "(\"Laptop\",1200),\n", + "(\"Tablet\",600),\n", + "(\"Phone\",800)\n", + "]\n", + "\n", + "# total revenue per product\n", + "revenue = {}\n", + "for product, price in sales:\n", + " if product in revenue:\n", + " revenue[product] += price\n", + " else:\n", + " revenue[product] = price\n", + "\n", + "print(\"Total Revenue by Product: \", revenue)\n", + "\n", + "# create a new dict product sorting according to product\n", + "sorted_pr = sorted(sales, key=lambda x: x[1]) \n", + "print(\"Products sorted by name: \", sorted_pr)\n", + "\n", + "#Identify the highest revenue generating product.\n", + "highest_revenue_product = max(revenue, key=revenue.get)\n", + "print(\"Highest Revenue Generating Product: \", highest_revenue_product)" + ] + } + ], + "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 +}