From b1a35f3978e41654bef4b2be8add3cd35471d582 Mon Sep 17 00:00:00 2001 From: itsladykerrtoo Date: Tue, 9 Apr 2024 16:21:28 -0500 Subject: [PATCH 01/17] update app name --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index b185ab1..06824aa 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@
-

Todo List

+

Git Going

From b54babb5d23e8413e0c007ddae25c860d931cc79 Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:20:00 -0500 Subject: [PATCH 02/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7accd68..762e494 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ git switch ### Step 2: Make changes You can add a new file, edit an existing file, or delete a file. -To keep things simple, let's edit the `index.html` file by changing the name to "GitGoing" on line 10. +To keep things simple, let's edit the `index.html` file by changing the name to "GitGoing-YourLastName" on line 10. ### Step 3: Stage your changes From 4b6ddfa89108d51ed772ac0b71d7da6faacc31dd Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:13:17 -0500 Subject: [PATCH 03/17] Delete styles.css --- styles.css | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 styles.css diff --git a/styles.css b/styles.css deleted file mode 100644 index c69bcc1..0000000 --- a/styles.css +++ /dev/null @@ -1,37 +0,0 @@ -body { - font-family: Arial, sans-serif; - background-color: #fbeeff; - padding: 30px; -} - -.todo-container { - background-color: #fff; - border-radius: 5px; - padding: 20px; - max-width: 500px; - margin: 0 auto; -} - -#todo-list { - list-style-type: none; - padding: 0; -} - -#todo-list li { - padding: 10px; - border: 1px solid #ddd; - margin-bottom: 10px; - position: relative; -} - -#todo-list li.done { - text-decoration: line-through; - color: #888; -} - -#todo-list li button { - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); -} \ No newline at end of file From 7f9ca4efede620252c82dc9ac5a8aced7101c674 Mon Sep 17 00:00:00 2001 From: itsladykerrtoo <157747484+itsladykerrtoo@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:50:57 -0500 Subject: [PATCH 04/17] Create Styling Create styles for app --- style.css | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 style.css diff --git a/style.css b/style.css new file mode 100644 index 0000000..c69bcc1 --- /dev/null +++ b/style.css @@ -0,0 +1,37 @@ +body { + font-family: Arial, sans-serif; + background-color: #fbeeff; + padding: 30px; +} + +.todo-container { + background-color: #fff; + border-radius: 5px; + padding: 20px; + max-width: 500px; + margin: 0 auto; +} + +#todo-list { + list-style-type: none; + padding: 0; +} + +#todo-list li { + padding: 10px; + border: 1px solid #ddd; + margin-bottom: 10px; + position: relative; +} + +#todo-list li.done { + text-decoration: line-through; + color: #888; +} + +#todo-list li button { + position: absolute; + right: 0; + top: 50%; + transform: translateY(-50%); +} \ No newline at end of file From a6c6cb8b965c4fe599bc11fe3e860d6c9e8a1cc6 Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:13:02 -0500 Subject: [PATCH 05/17] updating --- script.js | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 script.js diff --git a/script.js b/script.js deleted file mode 100644 index 42057f3..0000000 --- a/script.js +++ /dev/null @@ -1,39 +0,0 @@ -// Load todos from localStorage at startup -document.addEventListener('DOMContentLoaded', function() { - var todos = JSON.parse(localStorage.getItem('todos')) || []; - todos.forEach(addItem); -}); - -document.getElementById('add-todo').addEventListener('click', function() { - var value = document.getElementById('todo-input').value; - if (value) { - addItem(value); - document.getElementById('todo-input').value = ''; - saveTodos(); - } -}); - -function addItem(text) { - var list = document.getElementById('todo-list'); - - var item = document.createElement('li'); - item.innerText = text; - - var deleteButton = document.createElement('button'); - deleteButton.innerText = 'Delete'; - deleteButton.addEventListener('click', function() { - list.removeChild(item); - saveTodos(); - }); - - item.appendChild(deleteButton); - - list.appendChild(item); -} - -function saveTodos() { - var todos = Array.from(document.getElementById('todo-list').children).map(function(item) { - return item.innerText.replace('Delete', ''); - }); - localStorage.setItem('todos', JSON.stringify(todos)); -} \ No newline at end of file From 7b8057b78e762980e50a245261c2d4645f92283f Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:13:15 -0500 Subject: [PATCH 06/17] updating --- index.html | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index 06824aa..0000000 --- a/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - -
-

Git Going

- - -
    -
    - - - - \ No newline at end of file From 773418e4a2cb9d2b77e0a17be26083e86403a1b8 Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:13:35 -0500 Subject: [PATCH 07/17] updating --- style.css | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 style.css diff --git a/style.css b/style.css deleted file mode 100644 index c69bcc1..0000000 --- a/style.css +++ /dev/null @@ -1,37 +0,0 @@ -body { - font-family: Arial, sans-serif; - background-color: #fbeeff; - padding: 30px; -} - -.todo-container { - background-color: #fff; - border-radius: 5px; - padding: 20px; - max-width: 500px; - margin: 0 auto; -} - -#todo-list { - list-style-type: none; - padding: 0; -} - -#todo-list li { - padding: 10px; - border: 1px solid #ddd; - margin-bottom: 10px; - position: relative; -} - -#todo-list li.done { - text-decoration: line-through; - color: #888; -} - -#todo-list li button { - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); -} \ No newline at end of file From fa029c6a29d47c5818bf8dd6cbf70513fbf9b3a5 Mon Sep 17 00:00:00 2001 From: LadyKerr Date: Thu, 18 Jul 2024 12:22:34 -0500 Subject: [PATCH 08/17] created initil project --- index.html | 16 ++++++++++++++++ script.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 index.html create mode 100644 script.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..3d15e5f --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + + + +
    +

    Git Going

    + + +
      +
      + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..42057f3 --- /dev/null +++ b/script.js @@ -0,0 +1,39 @@ +// Load todos from localStorage at startup +document.addEventListener('DOMContentLoaded', function() { + var todos = JSON.parse(localStorage.getItem('todos')) || []; + todos.forEach(addItem); +}); + +document.getElementById('add-todo').addEventListener('click', function() { + var value = document.getElementById('todo-input').value; + if (value) { + addItem(value); + document.getElementById('todo-input').value = ''; + saveTodos(); + } +}); + +function addItem(text) { + var list = document.getElementById('todo-list'); + + var item = document.createElement('li'); + item.innerText = text; + + var deleteButton = document.createElement('button'); + deleteButton.innerText = 'Delete'; + deleteButton.addEventListener('click', function() { + list.removeChild(item); + saveTodos(); + }); + + item.appendChild(deleteButton); + + list.appendChild(item); +} + +function saveTodos() { + var todos = Array.from(document.getElementById('todo-list').children).map(function(item) { + return item.innerText.replace('Delete', ''); + }); + localStorage.setItem('todos', JSON.stringify(todos)); +} \ No newline at end of file From 4bd456a52985f9c5b3ab09b742c4e6e3203f4ed8 Mon Sep 17 00:00:00 2001 From: LadyKerr Date: Thu, 18 Jul 2024 12:50:46 -0500 Subject: [PATCH 09/17] created initial project --- style.css | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 style.css diff --git a/style.css b/style.css new file mode 100644 index 0000000..c69bcc1 --- /dev/null +++ b/style.css @@ -0,0 +1,37 @@ +body { + font-family: Arial, sans-serif; + background-color: #fbeeff; + padding: 30px; +} + +.todo-container { + background-color: #fff; + border-radius: 5px; + padding: 20px; + max-width: 500px; + margin: 0 auto; +} + +#todo-list { + list-style-type: none; + padding: 0; +} + +#todo-list li { + padding: 10px; + border: 1px solid #ddd; + margin-bottom: 10px; + position: relative; +} + +#todo-list li.done { + text-decoration: line-through; + color: #888; +} + +#todo-list li button { + position: absolute; + right: 0; + top: 50%; + transform: translateY(-50%); +} \ No newline at end of file From 10c782f7503e53ec195ba0a1a8cab00d7fa22b4d Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:01:29 -0500 Subject: [PATCH 10/17] Delete index.html --- index.html | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index 3d15e5f..0000000 --- a/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - -
      -

      Git Going

      - - -
        -
        - - \ No newline at end of file From 4065b9f4d140e671a7087c25284f99b11517bd8c Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:01:39 -0500 Subject: [PATCH 11/17] Delete script.js --- script.js | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 script.js diff --git a/script.js b/script.js deleted file mode 100644 index 42057f3..0000000 --- a/script.js +++ /dev/null @@ -1,39 +0,0 @@ -// Load todos from localStorage at startup -document.addEventListener('DOMContentLoaded', function() { - var todos = JSON.parse(localStorage.getItem('todos')) || []; - todos.forEach(addItem); -}); - -document.getElementById('add-todo').addEventListener('click', function() { - var value = document.getElementById('todo-input').value; - if (value) { - addItem(value); - document.getElementById('todo-input').value = ''; - saveTodos(); - } -}); - -function addItem(text) { - var list = document.getElementById('todo-list'); - - var item = document.createElement('li'); - item.innerText = text; - - var deleteButton = document.createElement('button'); - deleteButton.innerText = 'Delete'; - deleteButton.addEventListener('click', function() { - list.removeChild(item); - saveTodos(); - }); - - item.appendChild(deleteButton); - - list.appendChild(item); -} - -function saveTodos() { - var todos = Array.from(document.getElementById('todo-list').children).map(function(item) { - return item.innerText.replace('Delete', ''); - }); - localStorage.setItem('todos', JSON.stringify(todos)); -} \ No newline at end of file From 1157962e0318080e88a8267ab57810e681fd216e Mon Sep 17 00:00:00 2001 From: Kedasha Kerr <47188731+LadyKerr@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:01:50 -0500 Subject: [PATCH 12/17] updates --- style.css | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 style.css diff --git a/style.css b/style.css deleted file mode 100644 index c69bcc1..0000000 --- a/style.css +++ /dev/null @@ -1,37 +0,0 @@ -body { - font-family: Arial, sans-serif; - background-color: #fbeeff; - padding: 30px; -} - -.todo-container { - background-color: #fff; - border-radius: 5px; - padding: 20px; - max-width: 500px; - margin: 0 auto; -} - -#todo-list { - list-style-type: none; - padding: 0; -} - -#todo-list li { - padding: 10px; - border: 1px solid #ddd; - margin-bottom: 10px; - position: relative; -} - -#todo-list li.done { - text-decoration: line-through; - color: #888; -} - -#todo-list li button { - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); -} \ No newline at end of file From 410e26df37f969a7305ddaa4c9cfa8f117516424 Mon Sep 17 00:00:00 2001 From: itsladykerrtoo <157747484+itsladykerrtoo@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:13:04 +0000 Subject: [PATCH 13/17] add styling --- style.css | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 style.css diff --git a/style.css b/style.css new file mode 100644 index 0000000..c69bcc1 --- /dev/null +++ b/style.css @@ -0,0 +1,37 @@ +body { + font-family: Arial, sans-serif; + background-color: #fbeeff; + padding: 30px; +} + +.todo-container { + background-color: #fff; + border-radius: 5px; + padding: 20px; + max-width: 500px; + margin: 0 auto; +} + +#todo-list { + list-style-type: none; + padding: 0; +} + +#todo-list li { + padding: 10px; + border: 1px solid #ddd; + margin-bottom: 10px; + position: relative; +} + +#todo-list li.done { + text-decoration: line-through; + color: #888; +} + +#todo-list li button { + position: absolute; + right: 0; + top: 50%; + transform: translateY(-50%); +} \ No newline at end of file From 7f808081e15b68acd517cbc7d68b6839e0316dfb Mon Sep 17 00:00:00 2001 From: LadyKerr Date: Tue, 23 Jul 2024 12:22:47 -0500 Subject: [PATCH 14/17] created initial project --- index.html | 16 ++++++++++++++++ script.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 index.html create mode 100644 script.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..3d15e5f --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + + + +
        +

        Git Going

        + + +
          +
          + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..42057f3 --- /dev/null +++ b/script.js @@ -0,0 +1,39 @@ +// Load todos from localStorage at startup +document.addEventListener('DOMContentLoaded', function() { + var todos = JSON.parse(localStorage.getItem('todos')) || []; + todos.forEach(addItem); +}); + +document.getElementById('add-todo').addEventListener('click', function() { + var value = document.getElementById('todo-input').value; + if (value) { + addItem(value); + document.getElementById('todo-input').value = ''; + saveTodos(); + } +}); + +function addItem(text) { + var list = document.getElementById('todo-list'); + + var item = document.createElement('li'); + item.innerText = text; + + var deleteButton = document.createElement('button'); + deleteButton.innerText = 'Delete'; + deleteButton.addEventListener('click', function() { + list.removeChild(item); + saveTodos(); + }); + + item.appendChild(deleteButton); + + list.appendChild(item); +} + +function saveTodos() { + var todos = Array.from(document.getElementById('todo-list').children).map(function(item) { + return item.innerText.replace('Delete', ''); + }); + localStorage.setItem('todos', JSON.stringify(todos)); +} \ No newline at end of file From cf8f03bcc8d56634eacecd73a6df488318578329 Mon Sep 17 00:00:00 2001 From: Chinmay Nishank Date: Wed, 25 Feb 2026 16:17:07 +0530 Subject: [PATCH 15/17] Created using Colab --- Basic_python__projects_(1).ipynb | 369 +++++++++++++++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 Basic_python__projects_(1).ipynb diff --git a/Basic_python__projects_(1).ipynb b/Basic_python__projects_(1).ipynb new file mode 100644 index 0000000..5ad914a --- /dev/null +++ b/Basic_python__projects_(1).ipynb @@ -0,0 +1,369 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "background_save": true, + "base_uri": "https://localhost:8080/" + }, + "id": "HJ_tWUd6XhSq", + "outputId": "b1a44a99-f0c0-4ab8-ffcf-3caa919ccc87" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "1.Add 2.View 3.Issue 4.Return 5.Exit\n", + "\n", + "1.Add 2.View 3.Issue 4.Return 5.Exit\n", + "\n", + "1.Add 2.View 3.Issue 4.Return 5.Exit\n", + "Choice: 1\n" + ] + } + ], + "source": [ + "class Library:\n", + " def __init__(self):\n", + " self.books = {}\n", + "\n", + " def add(self, name, qty):\n", + " self.books[name] = self.books.get(name, 0) + qty\n", + "\n", + " def view(self):\n", + " if not self.books:\n", + " print(\"No books available\")\n", + " else:\n", + " for b, q in self.books.items():\n", + " print(b, \"-\", q)\n", + "\n", + " def issue(self, name):\n", + " if self.books.get(name, 0) > 0:\n", + " self.books[name] -= 1\n", + " print(\"Book issued\")\n", + " else:\n", + " print(\"Not available\")\n", + "\n", + " def return_book(self, name):\n", + " self.books[name] = self.books.get(name, 0) + 1\n", + " print(\"Book returned\")\n", + "\n", + "\n", + "lib = Library()\n", + "\n", + "while True:\n", + " print(\"\\n1.Add 2.View 3.Issue 4.Return 5.Exit\")\n", + " ch = input(\"Choice: \")\n", + "\n", + " if ch == \"1\":\n", + " lib.add(input(\"Book name: \"), int(input(\"Qty: \")))\n", + " elif ch == \"2\":\n", + " lib.view()\n", + " elif ch == \"3\":\n", + " lib.issue(input(\"Book name: \"))\n", + " elif ch == \"4\":\n", + " lib.return_book(input(\"Book name: \"))\n", + " elif ch == \"5\":\n", + " break\n", + " else:\n", + " print(\"Invalid choice\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Y2W--o8AY6k4" + }, + "outputs": [], + "source": [ + "import time\n", + "\n", + "while True:\n", + " print(\" Red Light - STOP\")\n", + " time.sleep(3)\n", + "\n", + " print(\"Yellow Light - WAIT\")\n", + " time.sleep(2)\n", + "\n", + " print(\"Green Light - GO\")\n", + " time.sleep(3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "tQtnWVEOZVvy" + }, + "outputs": [], + "source": [ + "class Cart:\n", + " def __init__(self):\n", + " self.items = {}\n", + "\n", + " def add(self, name, price, qty):\n", + " self.items[name] = [price, qty]\n", + "\n", + " def remove(self, name):\n", + " if name in self.items:\n", + " del self.items[name]\n", + " print(\"Item removed\")\n", + " else:\n", + " print(\"Item not found\")\n", + "\n", + " def view(self):\n", + " total = 0\n", + " if not self.items:\n", + " print(\"Cart is empty\")\n", + " else:\n", + " for name, (price, qty) in self.items.items():\n", + " cost = price * qty\n", + " total += cost\n", + " print(name, \"-\", qty, \"x\", price, \"=\", cost)\n", + " print(\"Total:\", total)\n", + "\n", + "\n", + "cart = Cart()\n", + "\n", + "while True:\n", + " print(\"\\n1.Add 2.Remove 3.View 4.Exit\")\n", + " ch = input(\"Choice: \")\n", + "\n", + " if ch == \"1\":\n", + " name = input(\"Product name: \")\n", + " price = float(input(\"Price: \"))\n", + " qty = int(input(\"Quantity: \"))\n", + " cart.add(name, price, qty)\n", + "\n", + " elif ch == \"2\":\n", + " cart.remove(input(\"Product name: \"))\n", + "\n", + " elif ch == \"3\":\n", + " cart.view()\n", + "\n", + " elif ch == \"4\":\n", + " break\n", + "\n", + " else:\n", + " print(\"Invalid choice\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "X1_TdeRrZzVZ" + }, + "outputs": [], + "source": [ + "class ATM:\n", + " def __init__(self):\n", + " self.accounts = {\n", + " \"1001\": {\"pin\": \"1234\", \"balance\": 5000},\n", + " \"1002\": {\"pin\": \"5678\", \"balance\": 8000}\n", + " }\n", + "\n", + " def login(self, acc, pin):\n", + " if acc in self.accounts and self.accounts[acc][\"pin\"] == pin:\n", + " return True\n", + " return False\n", + "\n", + " def check_balance(self, acc):\n", + " print(\"Balance:\", self.accounts[acc][\"balance\"])\n", + "\n", + " def deposit(self, acc, amt):\n", + " self.accounts[acc][\"balance\"] += amt\n", + " print(\"Deposited Successfully\")\n", + "\n", + " def withdraw(self, acc, amt):\n", + " if self.accounts[acc][\"balance\"] >= amt:\n", + " self.accounts[acc][\"balance\"] -= amt\n", + " print(\"Withdraw Successful\")\n", + " else:\n", + " print(\"Insufficient Balance\")\n", + "\n", + "\n", + "atm = ATM()\n", + "\n", + "acc = input(\"Enter Account Number: \")\n", + "pin = input(\"Enter PIN: \")\n", + "\n", + "if atm.login(acc, pin):\n", + " while True:\n", + " print(\"\\n1.Balance 2.Deposit 3.Withdraw 4.Exit\")\n", + " ch = input(\"Choice: \")\n", + "\n", + " if ch == \"1\":\n", + " atm.check_balance(acc)\n", + " elif ch == \"2\":\n", + " atm.deposit(acc, float(input(\"Amount: \")))\n", + " elif ch == \"3\":\n", + " atm.withdraw(acc, float(input(\"Amount: \")))\n", + " elif ch == \"4\":\n", + " break\n", + " else:\n", + " print(\"Invalid choice\")\n", + "else:\n", + " print(\"Invalid Account or PIN\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "CwhZZjCwaa4V" + }, + "outputs": [], + "source": [ + "class GradeBook:\n", + " def __init__(self):\n", + " self.students = {}\n", + "\n", + " def add_student(self, name, marks):\n", + " self.students[name] = marks\n", + "\n", + " def view_students(self):\n", + " if not self.students:\n", + " print(\"No records found\")\n", + " else:\n", + " for name, marks in self.students.items():\n", + " avg = sum(marks) / len(marks)\n", + " print(name, \"Marks:\", marks, \"Average:\", round(avg, 2))\n", + "\n", + " def calculate_grade(self, avg):\n", + " if avg >= 90:\n", + " return \"A\"\n", + " elif avg >= 75:\n", + " return \"B\"\n", + " elif avg >= 60:\n", + " return \"C\"\n", + " elif avg >= 40:\n", + " return \"D\"\n", + " else:\n", + " return \"F\"\n", + "\n", + "\n", + "gb = GradeBook()\n", + "\n", + "while True:\n", + " print(\"\\n1.Add Student 2.View Records 3.Exit\")\n", + " ch = input(\"Choice: \")\n", + "\n", + " if ch == \"1\":\n", + " name = input(\"Student Name: \")\n", + " marks = list(map(int, input(\"Enter marks separated by space: \").split()))\n", + " gb.add_student(name, marks)\n", + "\n", + " elif ch == \"2\":\n", + " if not gb.students:\n", + " print(\"No records found\")\n", + " else:\n", + " for name, marks in gb.students.items():\n", + " avg = sum(marks) / len(marks)\n", + " grade = gb.calculate_grade(avg)\n", + " print(name, \"Average:\", round(avg, 2), \"Grade:\", grade)\n", + "\n", + " elif ch == \"3\":\n", + " break\n", + " else:\n", + " print(\"Invalid choice\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "BCm0dM55abjP" + }, + "outputs": [], + "source": [ + "import hashlib\n", + "\n", + "class PasswordManager:\n", + " def __init__(self):\n", + " self.users = {}\n", + "\n", + " def hash_password(self, password):\n", + " return hashlib.sha256(password.encode()).hexdigest()\n", + "\n", + " def register(self, username, password):\n", + " if username in self.users:\n", + " print(\"User already exists\")\n", + " else:\n", + " self.users[username] = self.hash_password(password)\n", + " print(\"User registered successfully\")\n", + "\n", + " def login(self, username, password):\n", + " if username in self.users:\n", + " if self.users[username] == self.hash_password(password):\n", + " print(\"Login successful\")\n", + " else:\n", + " print(\"Incorrect password\")\n", + " else:\n", + " print(\"User not found\")\n", + "\n", + "\n", + "pm = PasswordManager()\n", + "\n", + "while True:\n", + " print(\"\\n1.Register 2.Login 3.Exit\")\n", + " ch = input(\"Choice: \")\n", + "\n", + " if ch == \"1\":\n", + " u = input(\"Username: \")\n", + " p = input(\"Password: \")\n", + " pm.register(u, p)\n", + "\n", + " elif ch == \"2\":\n", + " u = input(\"Username: \")\n", + " p = input(\"Password: \")\n", + " pm.login(u, p)\n", + "\n", + " elif ch == \"3\":\n", + " break\n", + "\n", + " else:\n", + " print(\"Invalid choice\")" + ] + }, + { + "cell_type": "code", + "source": [], + "metadata": { + "id": "Rj16nnHnWV7J" + }, + "execution_count": null, + "outputs": [] + } + ], + "metadata": { + "colab": { + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file From abccd498486bd5258f88b84a1ba2825625b7b0fd Mon Sep 17 00:00:00 2001 From: Chinmay Nishank Date: Thu, 12 Mar 2026 16:23:35 +0530 Subject: [PATCH 16/17] Created using Colab --- Exception_handling_problems | 284 ++++++++++++++++++++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 Exception_handling_problems diff --git a/Exception_handling_problems b/Exception_handling_problems new file mode 100644 index 0000000..7781354 --- /dev/null +++ b/Exception_handling_problems @@ -0,0 +1,284 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyNq2kW8yHS4UXPL+rHUfX+k", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "EScIumbUpxuT" + }, + "outputs": [], + "source": [ + "# Student Grade management System :\n", + "class InvalidStudentID(Exception):\n", + " pass\n", + "\n", + "students = {}\n", + "\n", + "while True:\n", + " try:\n", + " choice = input(\"1.Add 2.Update 3.Delete 4.View 5.Exit : \")\n", + "\n", + " if choice == \"1\":\n", + " sid = input(\"Enter student ID: \")\n", + " if sid == \"\":\n", + " raise InvalidStudentID(\"Student ID cannot be empty\")\n", + "\n", + " grade = int(input(\"Enter grade: \"))\n", + " students[sid] = grade\n", + " print(\"Student added\")\n", + "\n", + " elif choice == \"2\":\n", + " sid = input(\"Enter student ID to update: \")\n", + " if sid not in students:\n", + " raise InvalidStudentID(\"Student ID not found\")\n", + "\n", + " grade = int(input(\"Enter new grade: \"))\n", + " students[sid] = grade\n", + " print(\"Grade updated\")\n", + "\n", + " elif choice == \"3\":\n", + " sid = input(\"Enter student ID to delete: \")\n", + " if sid not in students:\n", + " raise InvalidStudentID(\"Student ID not found\")\n", + "\n", + " del students[sid]\n", + " print(\"Student deleted\")\n", + "\n", + " elif choice == \"4\":\n", + " print(students)\n", + "\n", + " elif choice == \"5\":\n", + " break\n", + "\n", + " except ValueError:\n", + " print(\"Grade must be a number\")\n", + "\n", + " except InvalidStudentID as e:\n", + " print(e)" + ] + }, + { + "cell_type": "code", + "source": [ + "# Contact Book :\n", + "contacts = {}\n", + "\n", + "try:\n", + " name = input(\"Enter name: \")\n", + " phone = input(\"Enter phone number: \")\n", + "\n", + " if name == \"\" or phone == \"\":\n", + " raise Exception(\"Fields cannot be empty\")\n", + "\n", + " if not phone.isdigit():\n", + " raise Exception(\"Invalid phone number\")\n", + "\n", + " if name in contacts:\n", + " raise Exception(\"Duplicate contact\")\n", + "\n", + " contacts[name] = phone\n", + "\n", + " search = input(\"Search contact name: \")\n", + "\n", + " print(\"Phone:\", contacts[search])\n", + "\n", + "except KeyError:\n", + " print(\"Contact not found\")\n", + "\n", + "except Exception as e:\n", + " print(e)" + ], + "metadata": { + "id": "ahv22cQTqGpo" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# Banking System With Transactions :\n", + "class OverdraftError(Exception):\n", + " pass\n", + "\n", + "accounts = {\"A101\": 5000, \"A102\": 3000}\n", + "\n", + "try:\n", + " sender = input(\"Sender account: \")\n", + " receiver = input(\"Receiver account: \")\n", + " amount = int(input(\"Enter amount: \"))\n", + "\n", + " if sender not in accounts or receiver not in accounts:\n", + " raise Exception(\"Invalid account number\")\n", + "\n", + " if accounts[sender] < amount:\n", + " raise OverdraftError(\"Insufficient balance\")\n", + "\n", + " accounts[sender] -= amount\n", + " accounts[receiver] += amount\n", + "\n", + " print(\"Transaction successful\")\n", + "\n", + "except OverdraftError as e:\n", + " print(e)\n", + "\n", + "except ValueError:\n", + " print(\"Invalid amount\")\n", + "\n", + "except Exception as e:\n", + " print(e)" + ], + "metadata": { + "id": "9pntvCh3qZjL" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# E-comerce order management :\n", + "stock = {\"Laptop\": 5, \"Phone\": 10}\n", + "\n", + "try:\n", + " product = input(\"Enter product: \")\n", + " quantity = int(input(\"Enter quantity: \"))\n", + " coupon = input(\"Enter coupon code: \")\n", + "\n", + " if product not in stock:\n", + " raise Exception(\"Product not available\")\n", + "\n", + " if stock[product] < quantity:\n", + " raise Exception(\"Out of stock\")\n", + "\n", + " if coupon != \"SAVE10\":\n", + " raise Exception(\"Invalid coupon code\")\n", + "\n", + " payment = input(\"Payment method: \")\n", + "\n", + " if payment not in [\"UPI\", \"Card\", \"Cash\"]:\n", + " raise Exception(\"Invalid payment method\")\n", + "\n", + " stock[product] -= quantity\n", + " print(\"Order placed successfully\")\n", + "\n", + "except ValueError:\n", + " print(\"Invalid quantity\")\n", + "\n", + "except Exception as e:\n", + " print(e)" + ], + "metadata": { + "id": "E7JTOPPtqzXT" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# Custom Exception Framework (Inventory System)\n", + "class OutOfStockError(Exception):\n", + " pass\n", + "\n", + "class InvalidProductIDError(Exception):\n", + " pass\n", + "\n", + "inventory = {\"P101\": 10, \"P102\": 0}\n", + "\n", + "try:\n", + " pid = input(\"Enter product ID: \")\n", + " qty = int(input(\"Enter quantity: \"))\n", + "\n", + " if pid not in inventory:\n", + " raise InvalidProductIDError(\"Invalid Product ID\")\n", + "\n", + " if inventory[pid] == 0:\n", + " raise OutOfStockError(\"Product out of stock\")\n", + "\n", + " inventory[pid] -= qty\n", + " print(\"Product purchased\")\n", + "\n", + "except InvalidProductIDError as e:\n", + " print(e)\n", + "\n", + "except OutOfStockError as e:\n", + " print(e)" + ], + "metadata": { + "id": "dYHg2ovlrGJS" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# Flight Booking System\n", + "class SeatNotAvailable(Exception):\n", + " pass\n", + "\n", + "seats = 5\n", + "\n", + "try:\n", + " name = input(\"Passenger name: \")\n", + " seats_required = int(input(\"Seats required: \"))\n", + "\n", + " if name == \"\":\n", + " raise Exception(\"Invalid passenger details\")\n", + "\n", + " if seats_required > seats:\n", + " raise SeatNotAvailable(\"Seats not available\")\n", + "\n", + " payment = input(\"Payment status (success/fail): \")\n", + "\n", + " if payment == \"fail\":\n", + " raise Exception(\"Payment failed\")\n", + "\n", + " seats -= seats_required\n", + "\n", + " print(\"Flight booked successfully\")\n", + "\n", + "except SeatNotAvailable as e:\n", + " print(e)\n", + "\n", + "except ValueError:\n", + " print(\"Invalid seat number\")\n", + "\n", + "except Exception as e:\n", + " print(e)" + ], + "metadata": { + "id": "fpbaFgaUrRU1" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 51bdd2f277af056dba9062559630c58361789422 Mon Sep 17 00:00:00 2001 From: Chinmay Nishank Date: Mon, 23 Mar 2026 16:22:57 +0530 Subject: [PATCH 17/17] Created using Colab --- tnp1.ipynb | 424 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 424 insertions(+) create mode 100644 tnp1.ipynb diff --git a/tnp1.ipynb b/tnp1.ipynb new file mode 100644 index 0000000..235a1bd --- /dev/null +++ b/tnp1.ipynb @@ -0,0 +1,424 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-U5e8pd8J8Ks", + "outputId": "fa2f3353-e2de-4d50-d5ce-fea57642353e" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Enter first number: 2\n", + "Enter second number: 1\n", + "Sum: 3\n", + "Difference: 1\n", + "Product: 2\n", + "Division: 2.0\n", + "Even/Odd: Even\n", + "Float value: 2.0\n" + ] + } + ], + "source": [ + "a = int(input(\"Enter first number: \"))\n", + "b = int(input(\"Enter second number: \"))\n", + "\n", + "print(\"Sum:\", a + b)\n", + "print(\"Difference:\", a - b)\n", + "print(\"Product:\", a * b)\n", + "print(\"Division:\", a / b)\n", + "\n", + "print(\"Even/Odd:\", \"Even\" if a % 2 == 0 else \"Odd\")\n", + "\n", + "print(\"Float value:\", float(a))" + ] + }, + { + "cell_type": "code", + "source": [ + "s = input(\"Enter sentence: \")\n", + "\n", + "vowels = \"aeiouAEIOU\"\n", + "v = sum(1 for ch in s if ch in vowels)\n", + "c = sum(1 for ch in s if ch.isalpha() and ch not in vowels)\n", + "\n", + "print(\"Vowels:\", v)\n", + "print(\"Consonants:\", c)\n", + "print(\"Reverse:\", s[::-1])\n", + "print(\"Underscore:\", s.replace(\" \", \"_\"))\n", + "print(\"Capitalized:\", s.title())" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-VPaZQJhMFBf", + "outputId": "5fdd7f08-cb09-4605-85d2-e326b9279efd" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Enter sentence: Swaraj\n", + "Vowels: 2\n", + "Consonants: 4\n", + "Reverse: jarawS\n", + "Underscore: Swaraj\n", + "Capitalized: Swaraj\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "t = (1, \"a\", 5, 10.5, 3)\n", + "\n", + "nums = [x for x in t if type(x) in [int, float]]\n", + "print(\"Numbers:\", nums)\n", + "\n", + "# Tuple can't be modified\n", + "try:\n", + " t[0] = 100\n", + "except:\n", + " print(\"Cannot modify tuple\")\n", + "\n", + "t2 = (9, 8)\n", + "print(\"Concatenated:\", t + t2)\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "sLLipOrNMVbM", + "outputId": "e73a1091-8d4b-4999-deca-eaf78c84b2b1" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Numbers: [1, 5, 10.5, 3]\n", + "Cannot modify tuple\n", + "Concatenated: (1, 'a', 5, 10.5, 3, 9, 8)\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "d = {\"Rahul\": 80, \"Priya\": 90}\n", + "\n", + "d[\"Amit\"] = 70\n", + "d[\"Rahul\"] = 85\n", + "del d[\"Priya\"]\n", + "\n", + "print(\"Keys:\", d.keys())\n", + "print(\"Values:\", d.values())\n", + "print(\"Items:\", d.items())" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "E7inXxH6Ma_N", + "outputId": "1aef8541-2921-4ea1-9611-cbf37edefd8f" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Keys: dict_keys(['Rahul', 'Amit'])\n", + "Values: dict_values([85, 70])\n", + "Items: dict_items([('Rahul', 85), ('Amit', 70)])\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "list = [\"madam\", \"hello\", \"racecar\", \"python\"]\n", + "\n", + "sorted_lst = sorted(lst, key=len)\n", + "print(\"Sorted:\", sorted_lst)\n", + "\n", + "pal = [x for x in lst if x == x[::-1]]\n", + "print(\"Palindromes:\", pal)\n", + "\n", + "new = [x.replace(\" \", \"-\") for x in lst]\n", + "print(\"Hyphen list:\", new)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dXpnIGKnMzW9", + "outputId": "021fb69e-10cc-4fc2-a939-3b299072dc7b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Sorted: ['madam', 'hello', 'python', 'racecar']\n", + "Palindromes: ['madam', 'racecar']\n", + "Hyphen list: ['madam', 'hello', 'racecar', 'python']\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "t = (5, 12, 3, 20, \"a\")\n", + "\n", + "lst = [x for x in t if not (type(x) == int and x < 10)]\n", + "\n", + "t = tuple(lst)\n", + "print(\"Result:\", t)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "deHauWJzPrV7", + "outputId": "f84511fe-bc74-48a5-f3ff-1402262dfa1f" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Result: (12, 20, 'a')\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "students = {}\n", + "\n", + "n = int(input(\"Enter number of students: \"))\n", + "\n", + "for i in range(n):\n", + " name = input(\"Name: \")\n", + " marks = int(input(\"Marks: \"))\n", + " students[name] = marks\n", + "\n", + "avg = sum(students.values()) / len(students)\n", + "topper = max(students, key=students.get)\n", + "\n", + "print(\"Average:\", avg)\n", + "print(\"Topper:\", topper)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "V6X0eByMP2NJ", + "outputId": "6af8140e-b6fe-4cde-92df-e6c3deee19b8" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Enter number of students: 2\n", + "Name: swaraj\n", + "Marks: 30\n", + "Name: kiran\n", + "Marks: 40\n", + "Average: 35.0\n", + "Topper: kiran\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "contacts = {}\n", + "\n", + "while True:\n", + " ch = input(\"1.Add 2.Search 3.Delete 4.Show 5.Exit: \")\n", + "\n", + " if ch == \"1\":\n", + " name = input(\"Name: \")\n", + " num = input(\"Number: \")\n", + " contacts[name] = num\n", + " elif ch == \"2\":\n", + " name = input(\"Search: \")\n", + " print(contacts.get(name, \"Not found\"))\n", + " elif ch == \"3\":\n", + " name = input(\"Delete: \")\n", + " contacts.pop(name, None)\n", + " elif ch == \"4\":\n", + " print(contacts)\n", + " else:\n", + " break" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "wV4qmRheRAXM", + "outputId": "f0ec5f55-ed92-4a6b-8d9a-dff548ae4806" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.Add 2.Search 3.Delete 4.Show 5.Exit: 1\n", + "Name: ikuu\n", + "Number: 56\n", + "1.Add 2.Search 3.Delete 4.Show 5.Exit: 2\n", + "Search: ikuu\n", + "56\n", + "1.Add 2.Search 3.Delete 4.Show 5.Exit: 4\n", + "{'ikuu': '56'}\n", + "1.Add 2.Search 3.Delete 4.Show 5.Exit: 3\n", + "Delete: ikuu\n", + "1.Add 2.Search 3.Delete 4.Show 5.Exit: 5\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "emp = {}\n", + "\n", + "while True:\n", + " ch = input(\"1.Add 2.Remove 3.Show 4.Exit: \")\n", + "\n", + " if ch == \"1\":\n", + " name = input(\"Name: \")\n", + " emp[name] = \"Present\"\n", + " elif ch == \"2\":\n", + " name = input(\"Remove: \")\n", + " emp.pop(name, None)\n", + " elif ch == \"3\":\n", + " print(emp)\n", + " else:\n", + " break" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "G_4ztrhARlYt", + "outputId": "e5d8c79e-ac5b-4cbd-c439-3b7b0b3912fe" + }, + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.Add 2.Remove 3.Show 4.Exit: 1\n", + "Name: ikuu\n", + "1.Add 2.Remove 3.Show 4.Exit: 3\n", + "{'ikuu': 'Present'}\n", + "1.Add 2.Remove 3.Show 4.Exit: 2\n", + "Remove: 1\n", + "1.Add 2.Remove 3.Show 4.Exit: 4\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "students = []\n", + "\n", + "n = int(input(\"Enter count: \"))\n", + "\n", + "for i in range(n):\n", + " name = input(\"Name: \")\n", + " roll = int(input(\"Roll: \"))\n", + " marks = int(input(\"Marks: \"))\n", + " students.append({\"name\": name, \"roll\": roll, \"marks\": marks})\n", + "\n", + "for s in students:\n", + " if s[\"marks\"] >= 40:\n", + " print(s[\"name\"], \"Pass\")\n", + " else:\n", + " print(s[\"name\"], \"Fail\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "kqJexREDRueM", + "outputId": "ea0a8d46-9d70-442a-e5c4-b61a10ca488c" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Enter count: 3\n", + "Name: ikuu\n", + "Roll: 164\n", + "Marks: 90\n", + "Name: bravo\n", + "Roll: 123\n", + "Marks: 34\n", + "Name: michel\n", + "Roll: 189\n", + "Marks: 76\n", + "ikuu Pass\n", + "bravo Fail\n", + "michel Pass\n" + ] + } + ] + } + ] +} \ No newline at end of file