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": [
+ "
"
+ ]
+ },
+ {
+ "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
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": [
+ "
"
+ ]
+ },
+ {
+ "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
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
diff --git a/index.html b/index.html
index b185ab1..3d15e5f 100644
--- a/index.html
+++ b/index.html
@@ -7,12 +7,10 @@
-
-
-