diff --git a/MadhuraBorikar_CSE_11mar.ipynb b/MadhuraBorikar_CSE_11mar.ipynb new file mode 100644 index 0000000..d026cd8 --- /dev/null +++ b/MadhuraBorikar_CSE_11mar.ipynb @@ -0,0 +1,91 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 12, + "id": "da9a4c01", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[78, 40, 92, 34, 67, 88, 53, 41, 76, 29]\n", + "[0, -5, 100, 40, 75]\n", + "[40, 34, 88, 41, 29, 81, 55, 90, 68, 84, -5, 40]\n", + "passed student : [78, 40, 92, 67, 88, 53, 41, 76, 64, 81, 55, 72, 90, 47, 68, 84, 100, 40, 75]\n", + "failed student : [34, 29, 39, 33, 0, -5]\n", + "Increased by 5 marks: [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 Student greater than 75: [78, 92, 88, 76, 81, 90, 84, 100]\n" + ] + } + ], + "source": [ + "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", + "\n", + "score_passed = []\n", + "score_failed =[]\n", + "\n", + "\n", + " \n", + "print(scores[0:10])\n", + "\n", + "print(scores[-5:])\n", + "\n", + "print(scores[1::2])\n", + "\n", + "\n", + "# checking if passed or failed\n", + "for score in scores:\n", + " if score >= 40:\n", + " score_passed.append(score)\n", + " else:\n", + " score_failed.append(score)\n", + "\n", + "\n", + "# Incresed by 5\n", + "increased_by_5 = []\n", + "for score in scores:\n", + " score+=5\n", + " increased_by_5.append(score)\n", + "\n", + "\n", + "greater_than_75 =[]\n", + "# Greater than 75\n", + "for score in scores:\n", + " if score > 75:\n", + " greater_than_75.append(score)\n", + "\n", + "\n", + "\n", + "\n", + " \n", + "print(f\"passed student : {score_passed}\")\n", + "print(f\"failed student : {score_failed}\")\n", + "print(f\"Increased by 5 marks: {increased_by_5}\") \n", + "print(f\"Top Student greater than 75: {greater_than_75}\")" + ] + } + ], + "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/MadhuraBorikar_CSE_12mar.ipynb b/MadhuraBorikar_CSE_12mar.ipynb new file mode 100644 index 0000000..bc8e889 --- /dev/null +++ b/MadhuraBorikar_CSE_12mar.ipynb @@ -0,0 +1,393 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "0a0f80f9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Day 1 sales : 1800\n", + "Day 2 sales : 1200\n", + "Day 3 sales : 900\n", + "Day 4 sales : 1150\n", + "Day 5 sales : 2560\n", + "Day 6 sales : 1890\n", + "Day 7 sales : 2200\n", + "[1800, 1200, 900, 1150, 2560, 1890, 2200]\n", + "Total sales of week: Rs 11700\n" + ] + } + ], + "source": [ + "sales_data = [\"1800\",\"1200\",\"900\",\"1150\",\"2560\",\"1890\",\"2200\"]\n", + "\n", + "total = 0\n", + "valid_sales = []\n", + "day = 1\n", + "for sale in sales_data:\n", + " sale = int(sale)\n", + " valid_sales.append(sale)\n", + " print(f\"Day {day} sales : {sale}\")\n", + " day+=1\n", + " total +=sale\n", + "\n", + " \n", + "\n", + "print(valid_sales)\n", + "print(f\"Total sales of week: Rs {total}\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "13b8b290", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1800, 1200, 900, 1150, 2560, 1890, 2200]\n" + ] + } + ], + "source": [ + "sales_int = [int(x) for x in sales_data]\n", + "print(sales_int)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "d5ab7394", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Day 1 sales : Rs.1800\n", + "Day 2 sales : Rs.1200\n", + "Day 3 sales : Rs.900\n", + "Day 4 sales : Rs.1150\n", + "Day 5 sales : Rs.2560\n", + "Day 6 sales : Rs.1890\n", + "Day 7 sales : Rs.2200\n", + "Total sales of the week: Rs.11700\n" + ] + } + ], + "source": [ + "for i, j in enumerate(sales_int, start=1):\n", + " print(f\"Day {i} sales : Rs.{j}\")\n", + "print(f\"Total sales of the week: Rs.{sum(sales_int)}\")\n", + "\n", + "\n", + "# pairs = dict(enumerate(sales_int, start=1))\n", + "# pairs" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "efe5983a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['C106', 'C101', 'C105', 'C104', 'C102', 'C103']\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", + "\n", + "\n", + "# sum of total revenue\n", + "\n", + "\n", + "# unique customers\n", + "unique_customers = list(set(order[1] for order in orders))\n", + "print(unique_customers)\n", + "\n", + "# result in dictionary with product as key and total revenue as value\n", + "\n", + "\n", + "\n", + "#\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "2b059b80", + "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 orders: 10\n", + "['Laptop', 'Phone', 'Laptop', 'Tablet', 'Phone', 'Headphones', 'Laptop', 'Laptop', 'Tablet', 'Phone']\n" + ] + } + ], + "source": [ + "# stage 1:\n", + "\n", + "# print all orders\n", + "for order in orders:\n", + " print(order)\n", + "\n", + "# priny total number of orders received\n", + "print(f\"Total orders: {len(orders)}\")\n", + "\n", + "# extracting product names from orders\n", + "product_name =[]\n", + "for order in orders:\n", + " product_name.append(order[2]) \n", + "print(product_name)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "dc6958ea", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('ORD006', 'C102', 'Headphones', 150)\n", + "('ORD001', 'C101', 'Laptop', 1200)\n", + "('ORD002', 'C102', 'Phone', 800)\n", + "('ORD009', 'C101', 'Phone', 800)\n", + "('ORD005', 'C104', 'Phone', 800)\n", + "('ORD008', 'C106', 'Tablet', 600)\n", + "('ORD004', 'C103', 'Tablet', 600)\n", + "('ORD003', 'C101', 'Laptop', 1200)\n", + "('ORD007', 'C105', 'Laptop', 1200)\n", + "Total unique orders: 9\n", + "{'C106', 'C101', 'C105', 'C104', 'C102', 'C103'}\n" + ] + } + ], + "source": [ + "# stage 2:\n", + "\n", + "# printing unique product names\n", + "unique_product = set(orders)\n", + "for i in unique_product:\n", + " print(i)\n", + "\n", + "\n", + "# printing total number of unique orders\n", + "total_unique_orders = len(unique_product)\n", + "print(f\"Total unique orders: {total_unique_orders}\")\n", + "\n", + "\n", + "# unique customers\n", + "customers = set(order[1] for order in orders)\n", + "print(customers)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "446262d8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Laptop', 'Phone', 'Laptop', 'Tablet', 'Phone', 'Headphones', 'Laptop', 'Laptop', 'Tablet', 'Phone']\n", + "{'Headphones', 'Tablet', 'Phone', 'Laptop'}\n", + "{'Laptop': 4, 'Phone': 3, 'Tablet': 2, 'Headphones': 1}\n" + ] + } + ], + "source": [ + "# Stage 3:\n", + "# list comprehension to extract product names\n", + "product_name_comp = [order[2] for order in orders] \n", + "print(product_name_comp)\n", + "\n", + "# set of unique product names using set comprehension\n", + "unique_product_comp = {order[2] for order in orders}\n", + "print(unique_product_comp)\n", + "\n", + "# how many times each product was ordered\n", + "product_count = {}\n", + "for order in orders:\n", + " product = order[2]\n", + " if product in product_count:\n", + " product_count[product] += 1\n", + " else:\n", + " product_count[product] = 1\n", + "print(product_count)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "a0524cd6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total revenue: Rs.8550\n", + "{'Laptop': 4800, 'Phone': 2400, 'Tablet': 1200, 'Headphones': 150}\n", + "Revenue for Laptop: Rs.4800\n", + "Revenue for Phone: Rs.2400\n", + "Revenue for Tablet: Rs.1200\n", + "Revenue for Headphones: Rs.150\n" + ] + } + ], + "source": [ + "# stage 4:\n", + "# total revenue\n", + "total_revenue = sum(order[3] for order in orders)\n", + "print(f\"Total revenue: Rs.{total_revenue}\") \n", + "\n", + "# store revenue by product in a dictionary\n", + "revenue_by_product = {}\n", + "for order in orders:\n", + " product = order[2]\n", + " revenue = order[3]\n", + " if product in revenue_by_product:\n", + " revenue_by_product[product] += revenue\n", + " else:\n", + " revenue_by_product[product] = revenue\n", + "print(revenue_by_product)\n", + "\n", + "# print revenue per product simple\n", + "for product, revenue in revenue_by_product.items():\n", + " print(f\"Revenue for {product}: Rs.{revenue}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "6b6aa07d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'C101': 4, 'C102': 2, 'C103': 1, 'C104': 1, 'C105': 1, 'C106': 1}\n", + "Customer C101 has the most orders with a total of 4\n" + ] + } + ], + "source": [ + "# stage 5\n", + "customer_to_no_of_orders = {}\n", + "for order in orders:\n", + " customer = order[1]\n", + " if customer in customer_to_no_of_orders:\n", + " customer_to_no_of_orders[customer] += 1\n", + " else:\n", + " customer_to_no_of_orders[customer] = 1\n", + "print(customer_to_no_of_orders)\n", + "\n", + "# maximum orders by a customer with customer id\n", + "max_customer = max(customer_to_no_of_orders, key=customer_to_no_of_orders.get)\n", + "max_orders = customer_to_no_of_orders[max_customer]\n", + "print(f\"Customer {max_customer} has the most orders with a total of {max_orders}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "f883f8a5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total revenue: Rs.8550\n", + "Product with highest revenue: Laptop\n", + "Customer with highest orders: C101\n", + "Total unique customers: 6\n", + "Total unique products: 4\n" + ] + } + ], + "source": [ + "# total reveneue \n", + "total_revenue = sum(order[3] for order in orders)\n", + "print(f\"Total revenue: Rs.{total_revenue}\")\n", + "\n", + "max_product = max(revenue_by_product, key=revenue_by_product.get)\n", + "# max_revenue = revenue_by_product[max_product]\n", + "print(f\"Product with highest revenue: {max_product}\")\n", + "\n", + "customer_highest_orders = max(customer_to_no_of_orders, key=customer_to_no_of_orders.get)\n", + "print(f\"Customer with highest orders: {customer_highest_orders}\")\n", + "\n", + "\n", + "total_unique_customers = len(set(order[1] for order in orders))\n", + "print(f\"Total unique customers: {total_unique_customers}\")\n", + "\n", + "total_unique_products = len(set(order[2] for order in orders))\n", + "print(f\"Total unique products: {total_unique_products}\")" + ] + } + ], + "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/MadhuraBorikar_CSE_14mar.ipynb b/MadhuraBorikar_CSE_14mar.ipynb new file mode 100644 index 0000000..3cb1fa5 --- /dev/null +++ b/MadhuraBorikar_CSE_14mar.ipynb @@ -0,0 +1,270 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 6, + "id": "2cd5d301", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'U104', 'U103', 'U102', 'U105', 'U101'}\n", + "total_unique_visitors : 5\n", + "['U104', 'U103', 'U102', 'U105', 'U101']\n" + ] + } + ], + "source": [ + "day_visits = [\"U101\",\"U102\",\"U103\",\"U101\",\"U104\",\"U102\",\"U105\",\"U103\"]\n", + "# unique visitors\n", + "unique_visits = set(day_visits)\n", + "print(unique_visits) \n", + "\n", + "# total unique visitors\n", + "total_unique_visitors = len(unique_visits)\n", + "print(f\"total_unique_visitors : {total_unique_visitors}\") \n", + "\n", + "# list of unique visitors\n", + "unique_visits_list = list(unique_visits)\n", + "print(unique_visits_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "7891b7db", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "U103 is a common visitor\n", + "U104 is a common visitor\n", + "U101 is a unique visitor in day1\n", + "U102 is a unique visitor in day1\n", + "Unique visitors in both days: {'U104', 'U103', 'U102', 'U106', 'U105', 'U101'}\n" + ] + } + ], + "source": [ + "# Data:\n", + "day1 = [\"U101\",\"U102\",\"U103\",\"U104\"]\n", + "day2 = [\"U103\",\"U104\",\"U105\",\"U106\"]\n", + "\n", + "\n", + "# common visitors\n", + "for i in day1:\n", + " if i in day2:\n", + " print(f\"{i} is a common visitor\")\n", + "\n", + "# only present in day1\n", + "for i in day1:\n", + " if i not in day2:\n", + " print(f\"{i} is a unique visitor in day1\")\n", + "\n", + "# unique visitors in both days\n", + "\n", + "unique_visitors_both_days = set(day1) | set(day2)\n", + "print(f\"Unique visitors in both days: {unique_visitors_both_days}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "124ad583", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'Laptop': 3, 'Phone': 2, 'Tablet': 1}\n", + "Laptop: 3 purchases\n", + "Phone: 2 purchases\n", + "Tablet: 1 purchases\n", + "Product Laptop has the most purchases with a total of 3\n" + ] + } + ], + "source": [ + "# Scenario:\n", + "# An e-commerce company wants to count how many times each product was purchased.\n", + "# Data:\n", + "purchases = [\"Laptop\",\"Phone\",\"Laptop\",\"Tablet\",\"Phone\",\"Laptop\"]\n", + "\n", + "# Create a dictionary storing product purchase frequency.\n", + "product_count = {}\n", + "for product in purchases:\n", + " if product in product_count:\n", + " product_count[product] += 1\n", + " else:\n", + " product_count[product] = 1\n", + "print(product_count)\n", + "\n", + "\n", + "# Print the dictionary.\n", + "for product, count in product_count.items():\n", + " print(f\"{product}: {count} purchases\")\n", + "\n", + "# Find the product with the most purchases and print it along with the number of purchases. \n", + "max_product = max(product_count, key=product_count.get)\n", + "max_purchases = product_count[max_product]\n", + "print(f\"Product {max_product} has the most purchases with a total of {max_purchases}\") " + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "4b35c70c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'Data Analyst': 2, 'Data Engineer': 2, 'ML Engineer': 1}\n", + "Data Analyst: 2 employees\n", + "Data Engineer: 2 employees\n", + "ML Engineer: 1 employees\n", + "Department Data Analyst has the most employees with a total of 2\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", + "\n", + "\n", + "# department-wise employee count\n", + "employees_dict ={}\n", + "for emp_id, role in employees:\n", + " if role in employees_dict:\n", + " employees_dict[role]+=1\n", + " else:\n", + " employees_dict[role] = 1\n", + "print(employees_dict)\n", + "\n", + "# employee count for each department\n", + "for department, count in employees_dict.items():\n", + " print(f\"{department}: {count} employees\")\n", + "\n", + "# department name with the highest number of employees \n", + "\n", + "max_department = max(employees_dict, key=employees_dict.get)\n", + "max_employees = employees_dict[max_department]\n", + "print(f\"Department {max_department} has the most employees with a total of {max_employees}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "76b4b0b9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Unique skills in the team: {'Tableau', 'SQL', 'Python', 'Machine Learning', 'Spark'}\n", + "Total unique skills in the team: 5\n", + "List of unique skills in the team: ['Machine Learning', 'Python', 'SQL', 'Spark', 'Tableau']\n" + ] + } + ], + "source": [ + "# Data:\n", + "team_skills = {\n", + "\"Alice\": [\"Python\",\"SQL\",\"Tableau\"],\n", + "\"Bob\": [\"Python\",\"Spark\",\"SQL\"],\n", + "\"Charlie\": [\"Python\",\"Machine Learning\",\"SQL\"]\n", + "}\n", + "\n", + "unique_skills = set()\n", + "for skills in team_skills.values():\n", + " unique_skills.update(skills) \n", + "\n", + "print(f\"Unique skills in the team: {unique_skills}\")\n", + "\n", + "print(f\"Total unique skills in the team: {len(unique_skills)}\")\n", + "\n", + "\n", + "\n", + "unique_skills_list = sorted(list(unique_skills))\n", + "print(f\"List of unique skills in the team: {unique_skills_list}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "77cf1cf5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'Laptop': 2400, 'Phone': 1600, 'Tablet': 600}\n", + "Laptop: $2400 total revenue\n", + "Phone: $1600 total revenue\n", + "Tablet: $600 total revenue\n", + "Product Laptop generated the most revenue with a total of $2400\n" + ] + } + ], + "source": [ + "sales = [\n", + "(\"Laptop\",1200),\n", + "(\"Phone\",800),\n", + "(\"Laptop\",1200),\n", + "(\"Tablet\",600),\n", + "(\"Phone\",800)\n", + "]\n", + "\n", + "product_revenue ={}\n", + "for product, price in sales:\n", + " if product in product_revenue:\n", + " product_revenue[product] += price\n", + " else:\n", + " product_revenue[product] = price\n", + "print(product_revenue)\n", + "\n", + "for product, revenue in product_revenue.items():\n", + " print(f\"{product}: ${revenue} total revenue\")\n", + "\n", + "\n", + "max_revenue_product = max(product_revenue, key=product_revenue.get)\n", + "max_revenue = product_revenue[max_revenue_product]\n", + "print(f\"Product {max_revenue_product} generated the most revenue with a total of ${max_revenue}\")" + ] + } + ], + "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/Notebook1.ipynb b/Notebook1.ipynb index f080647..4ff0562 100644 --- a/Notebook1.ipynb +++ b/Notebook1.ipynb @@ -22,16 +22,186 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "ca9af74b", "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name: Madhura, Age: 21, CGPA: 9.04\n" + ] + } + ], + "source": [ + "# Declaring 3 variables with different data types\n", + "name = \"Madhura\"\n", + "age = 21\n", + "cgpa = 9.04\n", + "\n", + "print(f\"Name: {name}, Age: {age}, CGPA: {cgpa}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "68231d5e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Lengthof list: 10\n", + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" + ] + } + ], + "source": [ + "# Defining a list with length 10\n", + "my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", + "print(\"Length of list: \", len(my_list))\n", + "print(my_list)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "12739e3a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Dictionary: {'name': 'Madhura', 'age': 21, 'cgpa': 9.04, 'hobbies': ['coding', 'reading', 'traveling'], 'is_student': True}\n", + "Name: Madhura\n" + ] + } + ], + "source": [ + "# Defining dict with edifferent data types and key value pairs\n", + "my_dict = {\n", + " \"name\": \"Madhura\",\n", + " \"age\": 21,\n", + " \"cgpa\": 9.04,\n", + " \"hobbies\": [\"coding\", \"reading\", \"traveling\"],\n", + " \"is_student\": True\n", + "}\n", + "print(\"Dictionary: \", my_dict)\n", + "print(\"Name: \", my_dict[\"name\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "0614d331", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 3, 4, 5}\n", + "(1, 2, 2, 3, 4, 3, 5)\n" + ] + } + ], + "source": [ + "list2 = [1,2,2,3,4,3,5]\n", + "\n", + "print(set(list2))\n", + "\n", + "# print(dict(list2))\n", + "print(tuple(list2))\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4324e2c4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "42.0\n", + "\n" + ] + }, + { + "data": { + "text/plain": [ + "'This is a multi-line comment\\nthat spans multiple lines.'" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str1 = \"Hello, World!\"\n", + "num1 = 42\n", + "print(type(num1))\n", + "print(float(num1))\n", + "\n", + "num2 = 3.14\n", + "print(type(num2))\n", + "print(int(num2))\n", + "\n", + "# This is a single-line comment\n", + "\"\"\"This is a multi-line comment\n", + "that spans multiple lines.\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "cc14438e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[2, 4, 6, 8, 10]\n", + "[1, 3, 5, 7, 9]\n" + ] + } + ], + "source": [ + "numbers = [1,2,3,4,5,6,7,8,9,10]\n", + "even =[]\n", + "odd = []\n", + "for i in numbers:\n", + " if i % 2 ==0:\n", + " even.append(i)\n", + " \n", + " else: \n", + " odd.append(i)\n", + "\n", + "print(even)\n", + "print(odd)\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "61576182", + "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { - "display_name": "myenv", + "display_name": "base", "language": "python", "name": "python3" }, @@ -45,7 +215,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.7" + "version": "3.13.9" } }, "nbformat": 4, diff --git a/pyt_MadhuraBorikar_3rdyr_10mar.ipynb b/pyt_MadhuraBorikar_3rdyr_10mar.ipynb new file mode 100644 index 0000000..6cfa691 --- /dev/null +++ b/pyt_MadhuraBorikar_3rdyr_10mar.ipynb @@ -0,0 +1,108 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "55cd7fc5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error : Invalid input. Please enter valid integer.\n" + ] + } + ], + "source": [ + "string1 = input(\"Enter the first string: \")\n", + "string2 = input(\"Enter the second string: \")\n", + "\n", + "\n", + "try:\n", + " divide = int(string1) / int(string2)\n", + " print(f\"The division of two integer is {divide}\") \n", + " \n", + "except ZeroDivisionError:\n", + " print(\"Error : Division by zero is not allowed.\")\n", + "\n", + "except ValueError:\n", + " print(\"Error : Invalid input. Please enter valid integer.\")" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "58f9b90b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The list of numbers is: ['1', 's', '2', 's', '3', 's', '4']\n", + "1 is an odd number.\n", + "2 is an even number.\n", + "3 is an odd number.\n", + "4 is an even number.\n", + "Valid numbers: [1, 2, 3, 4]\n", + "Number of valid numbers: 4\n", + "Invalid numbers: ['s', 's', 's']\n", + "Number of invalid numbers: 3\n" + ] + } + ], + "source": [ + "numbers = input(\"Enter numbers (seperated by space): \")\n", + "numbers_list = numbers.split()\n", + "print(f\"The list of numbers is: {numbers_list}\")\n", + "\n", + "valid_numbers = []\n", + "valid_count = 0\n", + "invalid_numbers = []\n", + "invalid_count = 0\n", + "\n", + "\n", + "for num in numbers_list:\n", + " try:\n", + " num_int = int(num)\n", + " valid_numbers.append(num_int)\n", + " valid_count += 1\n", + "\n", + " if num_int % 2 == 0:\n", + " print(f\"{num_int} is an even number.\")\n", + " else:\n", + " print(f\"{num_int} is an odd number.\")\n", + " except ValueError:\n", + " invalid_numbers.append(num)\n", + " invalid_count += 1\n", + "\n", + "print(f\"Valid numbers: {valid_numbers}\")\n", + "print(f\"Number of valid numbers: {valid_count}\")\n", + "print(f\"Invalid numbers: {invalid_numbers}\")\n", + "print(f\"Number of invalid numbers: {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/task1.ipynb b/task1.ipynb new file mode 100644 index 0000000..32d5b72 --- /dev/null +++ b/task1.ipynb @@ -0,0 +1,70 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f9a5b092", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "total discount: 60.0\n", + "total bill: 940.0\n" + ] + } + ], + "source": [ + "\n", + "# Madhura 12 Feb 2026\n", + "# discount calculator\n", + "original_price = float(input(\"Enter the original price of item: \"))\n", + "\n", + "\n", + "try :\n", + " original_price = float(original_price)\n", + "except ValueError:\n", + " print(\"Please enter a valid number for the original price.\")\n", + " exit()\n", + "\n", + "total_discount = 0\n", + "if original_price > 500 :\n", + " total_discount = (6*original_price)/100\n", + "elif original_price >1000:\n", + " total_discount = (10*original_price)/100\n", + "elif original_price >5000:\n", + " total_discount = (15*original_price)/100 \n", + "\n", + "print(f\"total discount: {total_discount}\")\n", + "\n", + "final_price = original_price-total_discount\n", + "\n", + "print(f\"total bill: {final_price}\")\n", + " \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 +}