REACT CODE FOR APPLE LIVE CHART

// TradingViewWidget.jsx
import React, { useEffect, useRef, memo } from 'react';

function TradingViewWidget() {
  const container = useRef();

  useEffect(
    () => {
      const script = document.createElement("script");
      script.src = "https://s3.tradingview.com/external-embedding/embed-widget-advanced-chart.js";
      script.type = "text/javascript";
      script.async = true;
      script.innerHTML = `
        {
          "width": "980",
          "height": "610",
          "symbol": "NASDAQ:AAPL",
          "interval": "D",
          "timezone": "Etc/UTC",
          "theme": "dark",
          "style": "1",
          "locale": "en",
          "withdateranges": true,
          "hide_side_toolbar": false,
          "allow_symbol_change": false,
          "details": true,
          "calendar": false,
          "show_popup_button": true,
          "popup_width": "1000",
          "popup_height": "650",
          "support_host": "https://www.tradingview.com"
        }`;
      container.current.appendChild(script);
    },
    []
  );

  return (
    <div className="tradingview-widget-container" ref={container}>
      <div className="tradingview-widget-container__widget"></div>
      <div className="tradingview-widget-copyright"><a href="https://www.tradingview.com/" rel="noopener nofollow" target="_blank"><span className="blue-text">Track all markets on TradingView</span></a></div>
    </div>
  );
}

export default memo(TradingViewWidget);
HTML

HTML CSS AND JS CODE FOR MACRO NUTRIENT CALCULATOR

FEATURE OF THE CODE

Key Features:

  1. User Input Fields:
    • Weight (in kilograms).
    • Height (in centimeters).
    • Age (in years).
    • Gender selection (Male/Female).
    • Activity level selection (Sedentary to Extra Active).
    • Custom macronutrient ratios for carbs, protein, and fats.
  2. Calorie Estimation:
    • Calculates Total Daily Energy Expenditure (TDEE) using the Mifflin-St Jeor Equation for Basal Metabolic Rate (BMR).
    • Adjusts calorie needs based on user-selected activity level.
  3. Macronutrient Breakdown:
    • Provides exact grams for carbohydrates, proteins, and fats based on calorie distribution and user-defined ratios.
  4. Validation System:
    • Ensures macronutrient ratios (carbs, protein, fats) add up to 100%. Alerts the user if they don’t.
  5. Dark/Light Mode Toggle:
    • Allows users to switch between light and dark themes dynamically.
    • Smooth transitions for a better visual experience.
  6. Enhanced User Interface:
    • Visually appealing layout with gradients and shadows.
    • Fully responsive design for all screen sizes.
  7. Animations and Graphics:
    • Fade-in effects for smooth page load.
    • Emojis for better user engagement and fun.
  8. Real-Time Calculations:
    • Instantly displays results for calories and macronutrients when the form is submitted.
  9. Customizable Macronutrient Ratios:
    • Users can set their own percentages for carbs, protein, and fats to fit specific dietary goals.
  10. Result Display:
  • Clear breakdown of estimated calorie needs.
  • Displays carbs, protein, and fat values in grams.
  1. Interactive Feedback:
  • Error messages and alerts to guide the user for valid input.
  1. Modern UX Enhancements:
  • Button hover effects and smooth transitions.
  • Accessibility-friendly design with simple navigation.
  1. Single Page Design:
  • All features integrated into one interactive and clean page.
  1. Mobile-Friendly:
  • Fully responsive for use on smartphones, tablets, and desktops.
  1. Dynamic Theme Update:
  • Changes both the background and text colors based on the selected theme.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Macronutrient Calculator</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background: linear-gradient(to right, #6a11cb, #2575fc);
      color: white;
      margin: 0;
      padding: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
      overflow: hidden;
    }

    .container {
      background: rgba(255, 255, 255, 0.1);
      padding: 20px;
      border-radius: 10px;
      width: 90%;
      max-width: 500px;
      text-align: center;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
      animation: fadeIn 2s ease-in-out;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(30px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    h1 {
      font-size: 2rem;
      margin-bottom: 10px;
    }

    form {
      display: flex;
      flex-direction: column;
      gap: 15px;
    }

    label {
      font-size: 1.2rem;
    }

    input, select, button {
      padding: 10px;
      border: none;
      border-radius: 5px;
      font-size: 1rem;
      width: 100%;
    }

    button {
      background: #00d4ff;
      color: white;
      cursor: pointer;
      transition: background 0.3s ease;
    }

    button:hover {
      background: #0066ff;
    }

    .result {
      margin-top: 20px;
      padding: 15px;
      background: rgba(0, 0, 0, 0.6);
      border-radius: 5px;
      font-size: 1.1rem;
      text-align: left;
    }

    .result span {
      display: block;
      margin: 5px 0;
    }

    .emoji {
      font-size: 2rem;
      margin: 15px 0;
    }

    .footer {
      margin-top: 20px;
      font-size: 0.8rem;
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>🥗 Macronutrient Calculator</h1>
    <p>Calculate your daily macronutrient needs for a healthier you! 🌟</p>

    <form id="macroForm">
      <label for="calories">Calories (kcal): 🔥</label>
      <input type="number" id="calories" placeholder="Enter your daily calories" required>

      <label for="carbRatio">Carbs Ratio (%): 🍞</label>
      <input type="number" id="carbRatio" placeholder="e.g., 50" required>

      <label for="proteinRatio">Protein Ratio (%): 🥩</label>
      <input type="number" id="proteinRatio" placeholder="e.g., 25" required>

      <label for="fatRatio">Fat Ratio (%): 🥑</label>
      <input type="number" id="fatRatio" placeholder="e.g., 25" required>

      <button type="submit">Calculate Macros 🧮</button>
    </form>

    <div id="result" class="result" style="display: none;">
      <p class="emoji">✨ Your Results:</p>
      <span id="carbs">Carbs: 0g</span>
      <span id="proteins">Proteins: 0g</span>
      <span id="fats">Fats: 0g</span>
    </div>

    <div class="footer">💡 Make sure your ratios add up to 100%!</div>
  </div>

  <script>
    document.getElementById("macroForm").addEventListener("submit", function (event) {
      event.preventDefault();

      // Retrieve input values
      const calories = parseInt(document.getElementById("calories").value);
      const carbRatio = parseInt(document.getElementById("carbRatio").value);
      const proteinRatio = parseInt(document.getElementById("proteinRatio").value);
      const fatRatio = parseInt(document.getElementById("fatRatio").value);

      // Check if ratios sum up to 100%
      if (carbRatio + proteinRatio + fatRatio !== 100) {
        alert("⚠️ Ratios must add up to 100%!");
        return;
      }

      // Macronutrient calculations
      const carbs = Math.round((calories * carbRatio / 100) / 4);
      const proteins = Math.round((calories * proteinRatio / 100) / 4);
      const fats = Math.round((calories * fatRatio / 100) / 9);

      // Display results
      document.getElementById("result").style.display = "block";
      document.getElementById("carbs").textContent = `Carbs: ${carbs}g`;
      document.getElementById("proteins").textContent = `Proteins: ${proteins}g`;
      document.getElementById("fats").textContent = `Fats: ${fats}g`;
    });
  </script>
</body>
</html>
HTML

NEPAL FOREIGN RESERVE REACHES ALL TIME HIGH

According to Nepal Rastra Bank, by the end of the first quarter of the current fiscal year, the country’s foreign exchange reserves have reached more than 16.5 billion US dollars. This is the highest level of reserves in the last 5 years.

As of the end of Ashoj (October) 2081, the total foreign exchange reserves in the country have amounted to 16.6 billion US dollars, which is an 8.7% increase compared to the same period last year. The total foreign exchange reserves, valued at NPR 20 trillion 41 billion 100 million as of the end of Asar (July) 2081, increased by 9.4%, reaching NPR 22 trillion 32 billion 280 million by the end of Ashoj.

Of the total foreign exchange reserves, the reserves held by Nepal Rastra Bank have increased by 7.5% to reach NPR 19 trillion 88 billion by the end of Ashoj 2081, up from NPR 18 trillion 48 billion 550 million at the end of Asar. Foreign exchange reserves held by banks and financial institutions (excluding Nepal Rastra Bank) increased by 26.9% to reach NPR 2 trillion 44 billion 270 million, compared to NPR 1 trillion 92 billion 550 million at the end of Asar.

The share of Indian currency in the total foreign exchange reserves as of the end of Ashoj 2081 stands at 21.9%.

G CLASS COMPANIES IN NEPSE

Company Data

Company Data Table

SN Name Symbol Status Sector Class Instrument
101 Sagarmatha Jalabidhyut Company Limited SMJC Active Hydro Power G Equity
102 Aatmanirbhar Laghubitta Bittitya Sanstha Limited ANLB Active Microfinance G Equity
103 Makar Jitumaya Suri Hydropower Ltd MAKAR Active Hydro Power G Equity
104 MaiKhola Hydropower Limited MKHL Active Hydro Power G Equity
105 Dolti Power Company Ltd. DOLTI Active Hydro Power G Equity
106 Bhugol Energy Development Company Ltd BEDC Active Hydro Power G Equity
107 CITY HOTEL LIMITED CITY Active Hotels And Tourism G Equity
108 Menchhiyam Hydro Power Ltd MCHL Active Hydro Power G Equity
109 Ingwa Hydropower Limited IHL Active Hydro Power G Equity
110 Modi Energy Limited MEL Active Hydro Power G Equity
111 Rawa Energy Development Ltd. RAWA Active Hydro Power G Equity
112 Nepal Republic Media Ltd NRM Active Others G Equity
113 I.M.E. Life Insurance company Limited ILI Active Life Insurance G Equity
114 Upper Syange Hydropower Limited USHL Active Hydro Power G Equity
115 Ghorahi Cement Industry Limited GCIL Active Manufacturing And Processing G Equity
116 Three Star Hydropower Ltd TSHL Active Hydro Power G Equity
117 Kutheli Bukhari Small Hydropower Ltd KBSH Active Hydro Power G Equity
118 Reliable Nepal Life Insurance Ltd RNLI Active Life Insurance G Equity
119 Sun Nepal Life Insurance Company Limited SNLI Active Life Insurance G Equity
120 Manakamana Engineering Hydropower Limited MEHL Active Hydro Power G Equity

NEPSE SUMMARY NOV 19 2024

SUMMARY

Market Summary

Market Summary

Total Turnover Rs: 10,468,320,521.90
Total Traded Shares: 22,588,247
Total Transactions: 105,827
Total Scrips Traded: 310
Total Market Capitalization Rs: 4,303,441,758,210.3
Total Float Market Capitalization Rs: 1,518,727,189,502.1

GAINER

Top Gainers

Top Gainers 💹

Symbol LTP Pt. Change % Change
ANLB 🏆 5,226.00 +475.00 +10.00%
NABBC 💼 1,106.00 +75.00 +7.27%
GLBSL 📊 2,913.00 +160.80 +5.84%
UNLB 📈 3,160.00 +161.00 +5.37%
PFL 🔥 773.00 +30.00 +4.04%
SRBLD83 🏅 1,122.00 +40.90 +3.78%
MLBS 📈 2,288.00 +83.00 +3.76%
ILBS 💹 1,090.00 +37.00 +3.51%
HURJA ⚡ 243.00 +8.00 +3.40%
NIBLSTF 🔍 9.00 +0.25 +2.86%

LOSER

Top Losers

Top Losers 📉

Symbol LTP Pt. Change % Change
NGPL 💥 518.20 -52.80 -9.25%
SFCL 💣 800.00 -74.80 -8.55%
JFL ⚡ 974.90 -87.10 -8.20%
DLBS 🧨 1,599.00 -138.00 -7.94%
MHCL 🚨 435.00 -32.00 -6.85%
MKHL ⚠️ 557.10 -40.90 -6.84%
NWCL ⚠️ 1,038.80 -75.10 -6.74%
PHCL 💢 590.00 -42.00 -6.65%
GMFBS ❌ 1,760.00 -123.10 -6.54%
BHDC 🔻 640.00 -39.90 -5.87%

TOP TURNOVER

Turnover

Turnover 💰

Symbol Turnover LTP
NGPL 💥 466,899,805.77 518.20
SFCL 💣 290,862,061.60 800.00
PFL ⚡ 249,274,171.60 773.00
PHCL 🧨 239,482,270.30 590.00
SHEL 🚨 237,535,474.70 267.00
HURJA ⚠️ 209,600,277.50 243.00
JFL 🔻 198,415,478.20 974.90
NFS 💥 157,237,550.60 1,468.00
SAPDBL 💎 148,349,124.30 772.10
HRL 🌟 147,541,998.70 866.00

TOP VOLUME

Top Volume

Top Volume 📊

Symbol Shares Traded LTP
NGPL 💥 888,319 518.20
HURJA ⚡ 874,253 243.00
SHEL 🚨 869,587 267.00
HIDCLP 🌟 759,880 177.90
SAEF 💡 475,261 11.23
PHCL 💣 402,032 590.00
AKJCL 🔥 365,848 211.50
SFCL 💎 348,475 800.00
NICBF 💥 343,116 10.02
PFL ⚡ 322,179 773.00

TOP TRANSACTION

Top Transactions

Top Transactions 💸

Symbol No. of Transactions LTP
NGPL 💥 2,570 518.20
HURJA ⚡ 2,384 243.00
SFCL 💎 2,225 800.00
SHEL 🚨 2,211 267.00
PFL ⚡ 1,977 773.00
HRL 🌟 1,744 866.00
SAHAS 🔥 1,235 530.10
JFL 💥 1,212 974.90
PHCL 💡 1,203 590.00
NIFRA 🚀 1,093 273.50

260 MOSTLY USED PROGRAM CODE IN PHP

<?php
// ============================
// 1. Simple Calculator
// ============================
function calculator($a, $b, $operation) {
    switch($operation) {
        case 'add':
            return $a + $b;
        case 'subtract':
            return $a - $b;
        case 'multiply':
            return $a * $b;
        case 'divide':
            return $a / $b;
        default:
            return "Invalid operation!";
    }
}

// ============================
// 2. Todo List
// ============================
$todolist = array("Buy groceries", "Complete homework", "Read a book");
echo "Todo List: <br>";
foreach ($todolist as $task) {
    echo $task . "<br>";
}

// ============================
// 3. Login System
// ============================
session_start();
function login($username, $password) {
    $users = [
        'admin' => 'password123',
        'user' => 'pass456'
    ];
    if (isset($users[$username]) && $users[$username] == $password) {
        $_SESSION['logged_in'] = true;
        echo "Logged in successfully!";
    } else {
        echo "Invalid login details!";
    }
}

// ============================
// 4. Basic Contact Form
// ============================
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = $_POST['name'];
    $email = $_POST['email'];
    echo "Thank you, $name! We have received your message.";
}
?>
<form method="post" action="">
    Name: <input type="text" name="name"><br>
    Email: <input type="email" name="email"><br>
    <input type="submit" value="Submit">
</form>

// ============================
// 5. File Upload
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_FILES['file'])) {
        $fileName = $_FILES['file']['name'];
        move_uploaded_file($_FILES['file']['tmp_name'], "uploads/$fileName");
        echo "File uploaded successfully!";
    }
}
?>
<form method="POST" enctype="multipart/form-data">
    Upload file: <input type="file" name="file"><br>
    <input type="submit" value="Upload">
</form>

// ============================
// 6. Simple Blog
// ============================
$blogPosts = [
    ['title' => 'First Post', 'content' => 'This is the first post content.'],
    ['title' => 'Second Post', 'content' => 'This is the second post content.']
];
foreach ($blogPosts as $post) {
    echo "<h2>{$post['title']}</h2>";
    echo "<p>{$post['content']}</p>";
}

// ============================
// 7. Search Engine
// ============================
$database = ["apple", "banana", "cherry", "date", "elderberry"];
if (isset($_POST['search'])) {
    $term = $_POST['search'];
    $results = array_filter($database, function($item) use ($term) {
        return strpos($item, $term) !== false;
    });
    echo "Results: <br>";
    foreach ($results as $result) {
        echo $result . "<br>";
    }
}
?>
<form method="POST">
    Search: <input type="text" name="search"><br>
    <input type="submit" value="Search">
</form>

// ============================
// 8. Comment System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $comment = $_POST['comment'];
    echo "You commented: $comment";
}
?>
<form method="POST">
    Comment: <textarea name="comment"></textarea><br>
    <input type="submit" value="Submit">
</form>

// ============================
// 9. Simple Poll
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    echo "Thank you for voting for: $vote!";
}
?>
<form method="POST">
    What is your favorite fruit?<br>
    <input type="radio" name="vote" value="Apple"> Apple<br>
    <input type="radio" name="vote" value="Banana"> Banana<br>
    <input type="radio" name="vote" value="Cherry"> Cherry<br>
    <input type="submit" value="Vote">
</form>

// ============================
// 10. Image Gallery
// ============================
$images = scandir('gallery');
foreach ($images as $image) {
    if ($image != '.' && $image != '..') {
        echo "<img src='gallery/$image' width='200' height='200'><br>";
    }
}

// ============================
// 11. Chat Application (Simple Version)
// ============================
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $message = $_POST['message'];
    $_SESSION['messages'][] = $message;
}
?>
<form method="POST">
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Send">
</form>
<h3>Chat History:</h3>
<?php
if (isset($_SESSION['messages'])) {
    foreach ($_SESSION['messages'] as $msg) {
        echo "$msg<br>";
    }
}
?>
  
// ============================
// 12. Registration System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];
    // Here, save the data to a database or file.
    echo "User $username registered successfully!";
}
?>
<form method="POST">
    Username: <input type="text" name="username"><br>
    Password: <input type="password" name="password"><br>
    <input type="submit" value="Register">
</form>

// ============================
// 13. Newsletter Subscription
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $email = $_POST['email'];
    // Here, save the email to a database or mailing list.
    echo "You have been subscribed with email: $email";
}
?>
<form method="POST">
    Email: <input type="email" name="email"><br>
    <input type="submit" value="Subscribe">
</form>

// ============================
// 14. Feedback Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $feedback = $_POST['feedback'];
    echo "Thank you for your feedback: $feedback";
}
?>
<form method="POST">
    Feedback: <textarea name="feedback"></textarea><br>
    <input type="submit" value="Submit">
</form>

// ============================
// 15. Task Management System
// ============================
$tasks = [
    ['task' => 'Do laundry', 'status' => 'Pending'],
    ['task' => 'Buy groceries', 'status' => 'Completed']
];
echo "<h3>Task List</h3>";
foreach ($tasks as $task) {
    echo "{$task['task']} - {$task['status']}<br>";
}

// ============================
// 16. Password Strength Checker
// ============================
function checkPasswordStrength($password) {
    if (strlen($password) < 8) {
        return "Weak password";
    } elseif (preg_match('/[A-Z]/', $password) && preg_match('/[a-z]/', $password) && preg_match('/[0-9]/', $password)) {
        return "Strong password";
    }
    return "Moderate password";
}
echo checkPasswordStrength('password123'); // Example output: "Moderate password"

// ============================
// 17. Weather Report (Using API)
// ============================
$city = 'London';
$apiKey = 'your_api_key';
$weatherData = file_get_contents("https://api.openweathermap.org/data/2.5/weather?q=$city&appid=$apiKey");
$weather = json_decode($weatherData, true);
echo "Weather in $city: " . $weather['weather'][0]['description'];

// ============================
// 18. URL Shortener
// ============================
function shortenUrl($url) {
    return substr(md5($url), 0, 6);
}
echo "Shortened URL: " . shortenUrl("https://example.com");

// ============================
// 19. Currency Converter
// ============================
$exchangeRate = 0.85; // Example: USD to EUR
$amount = 100;
$convertedAmount = $amount * $exchangeRate;
echo "$$amount USD is €$convertedAmount EUR";

// ============================
// 20. Birthday Reminder
// ============================
$birthdays = [
    'John' => '1990-12-25',
    'Jane' => '1985-07-15'
];
foreach ($birthdays as $name => $date) {
    echo "$name's birthday is on $date.<br>";
}

?>
<?php
// ============================
// 40. Simple E-commerce Cart
// ============================
$products = [
    ['name' => 'Laptop', 'price' => 1000],
    ['name' => 'Phone', 'price' => 500],
    ['name' => 'Headphones', 'price' => 100]
];

$total = 0;
echo "<h3>Shopping Cart</h3>";
foreach ($products as $product) {
    echo $product['name'] . " - $" . $product['price'] . "<br>";
    $total += $product['price'];
}
echo "Total: $" . $total;

// ============================
// 41. User Registration with Email Verification
// ============================
function sendVerificationEmail($email) {
    // Send email using mail() function
    echo "Verification email sent to $email";
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $email = $_POST['email'];
    sendVerificationEmail($email);
    echo "User registered successfully!";
}
?>
<form method="POST">
    Email: <input type="email" name="email"><br>
    <input type="submit" value="Register">
</form>

// ============================
// 42. Online Poll with Multiple Options
// ============================
$pollOptions = ['Yes', 'No', 'Maybe'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    echo "You voted for: $vote";
}
?>
<form method="POST">
    Do you like PHP?
    <?php foreach ($pollOptions as $option) : ?>
        <input type="radio" name="vote" value="<?= $option ?>"><?= $option ?><br>
    <?php endforeach; ?>
    <input type="submit" value="Vote">
</form>

// ============================
// 43. Simple To-Do List with Database
// ============================
$tasks = [
    ['task' => 'Clean the house', 'completed' => false],
    ['task' => 'Buy groceries', 'completed' => true]
];
echo "<h3>Task List</h3>";
foreach ($tasks as $task) {
    echo $task['task'] . ($task['completed'] ? ' (Completed)' : ' (Pending)') . "<br>";
}

// ============================
// 44. Simple Feedback System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $feedback = $_POST['feedback'];
    echo "Feedback received: $feedback";
}
?>
<form method="POST">
    Feedback: <textarea name="feedback"></textarea><br>
    <input type="submit" value="Submit Feedback">
</form>

// ============================
// 45. File Management System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $filename = $_POST['filename'];
    if (file_exists($filename)) {
        $content = file_get_contents($filename);
        echo "File contents: $content";
    } else {
        echo "File does not exist!";
    }
}
?>
<form method="POST">
    Enter filename: <input type="text" name="filename"><br>
    <input type="submit" value="Read File">
</form>

// ============================
// 46. Simple Chatbot
// ============================
function chatbotResponse($input) {
    $responses = [
        'hello' => 'Hi there!',
        'how are you' => 'I\'m doing great, thanks!',
        'bye' => 'Goodbye!'
    ];
    return isset($responses[strtolower($input)]) ? $responses[strtolower($input)] : "I don't understand.";
}

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $userInput = $_POST['input'];
    echo "Bot: " . chatbotResponse($userInput);
}
?>
<form method="POST">
    You: <input type="text" name="input"><br>
    <input type="submit" value="Send">
</form>

// ============================
// 47. Currency Conversion System
// ============================
$currencyRates = ['USD' => 1, 'EUR' => 0.85, 'GBP' => 0.75];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $amount = $_POST['amount'];
    $fromCurrency = $_POST['from_currency'];
    $toCurrency = $_POST['to_currency'];
    $convertedAmount = $amount * $currencyRates[$toCurrency] / $currencyRates[$fromCurrency];
    echo "$amount $fromCurrency = $convertedAmount $toCurrency";
}
?>
<form method="POST">
    Amount: <input type="number" name="amount"><br>
    From: 
    <select name="from_currency">
        <option value="USD">USD</option>
        <option value="EUR">EUR</option>
        <option value="GBP">GBP</option>
    </select><br>
    To: 
    <select name="to_currency">
        <option value="USD">USD</option>
        <option value="EUR">EUR</option>
        <option value="GBP">GBP</option>
    </select><br>
    <input type="submit" value="Convert">
</form>

// ============================
// 48. Simple CMS (Content Management System)
// ============================
$pages = [
    'home' => 'Welcome to our website!',
    'about' => 'We are a tech company.',
    'contact' => 'Contact us at contact@example.com.'
];
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
echo "<h2>{$pages[$page]}</h2>";
echo "<a href='?page=home'>Home</a> | <a href='?page=about'>About</a> | <a href='?page=contact'>Contact</a>";

// ============================
// 49. User Authentication System
// ============================
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];
    // Dummy users
    $users = [
        'admin' => 'admin123',
        'user' => 'user123'
    ];
    if (isset($users[$username]) && $users[$username] == $password) {
        $_SESSION['username'] = $username;
        echo "Welcome, $username!";
    } else {
        echo "Invalid login details!";
    }
}
?>
<form method="POST">
    Username: <input type="text" name="username"><br>
    Password: <input type="password" name="password"><br>
    <input type="submit" value="Login">
</form>

// ============================
// 50. Guestbook
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $message = $_POST['message'];
    echo "<strong>$name</strong>: $message<br>";
}
?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Sign Guestbook">
</form>

// ============================
// 51. Image Slider
// ============================
$images = ['img1.jpg', 'img2.jpg', 'img3.jpg'];
echo "<div id='slider'>";
foreach ($images as $image) {
    echo "<img src='$image' alt='Slider Image' />";
}
echo "</div>";
?>

// ============================
// 52. Blog with Pagination
// ============================
$posts = [
    'Post 1' => 'This is the first post.',
    'Post 2' => 'This is the second post.',
    'Post 3' => 'This is the third post.',
    'Post 4' => 'This is the fourth post.',
];
$limit = 2; // Posts per page
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$start = ($page - 1) * $limit;
$end = $start + $limit;

echo "<h2>Blog</h2>";
for ($i = $start; $i < $end; $i++) {
    if (isset($posts[$i])) {
        echo "<h3>{$posts[$i]}</h3>";
    }
}

echo "<div>Pages: ";
for ($i = 1; $i <= ceil(count($posts) / $limit); $i++) {
    echo "<a href='?page=$i'>$i</a> ";
}
echo "</div>";
?>

// ============================
// 53. File Encryption and Decryption
// ============================
function encrypt($data) {
    return base64_encode($data);
}

function decrypt($data) {
    return base64_decode($data);
}

$data = "Hello World!";
$encrypted = encrypt($data);
$decrypted = decrypt($encrypted);

echo "Original Data: $data<br>";
echo "Encrypted Data: $encrypted<br>";
echo "Decrypted Data: $decrypted<br>";
?>

<?php
// ============================
// 54. URL Shortener
// ============================
function shortenUrl($url) {
    return base64_encode($url);
}

function expandUrl($shortenedUrl) {
    return base64_decode($shortenedUrl);
}

$url = "https://www.example.com";
$shortened = shortenUrl($url);
$expanded = expandUrl($shortened);

echo "Original URL: $url<br>";
echo "Shortened URL: $shortened<br>";
echo "Expanded URL: $expanded<br>";
?>

// ============================
// 55. Weather API Integration
// ============================
$apiKey = "YOUR_API_KEY";
$city = "London";
$url = "http://api.openweathermap.org/data/2.5/weather?q=$city&appid=$apiKey";
$response = file_get_contents($url);
$data = json_decode($response, true);

echo "Weather in $city: " . $data['weather'][0]['description'] . "<br>";
echo "Temperature: " . ($data['main']['temp'] - 273.15) . "°C<br>";

// ============================
// 56. Admin Dashboard
// ============================
echo "<h1>Admin Dashboard</h1>";
$stats = [
    'Total Users' => 1200,
    'Active Users' => 800,
    'Pending Orders' => 30
];

foreach ($stats as $key => $value) {
    echo "$key: $value<br>";
}

// ============================
// 57. News Aggregator
// ============================
$news = [
    'Breaking News: PHP is awesome!',
    'New PHP 8 Features Announced',
    'How to Learn PHP in 30 Days'
];

echo "<h3>Latest News</h3>";
foreach ($news as $item) {
    echo "$item<br>";
}

// ============================
// 58. Subscription Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $email = $_POST['email'];
    echo "Thank you for subscribing! We will send updates to $email.";
}
?>
<form method="POST">
    Enter your email: <input type="email" name="email"><br>
    <input type="submit" value="Subscribe">
</form>

// ============================
// 59. Poll Voting System with Results
// ============================
$options = ['Option 1', 'Option 2', 'Option 3'];
$votes = [0, 0, 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    $votes[$vote]++;
}

echo "<h3>Poll Results</h3>";
foreach ($options as $index => $option) {
    echo "$option: " . $votes[$index] . " votes<br>";
}
?>
<form method="POST">
    <p>Vote for your favorite option:</p>
    <?php foreach ($options as $index => $option) : ?>
        <input type="radio" name="vote" value="<?= $index ?>"><?= $option ?><br>
    <?php endforeach; ?>
    <input type="submit" value="Vote">
</form>

// ============================
// 60. Task Management System
// ============================
$tasks = [
    ['task' => 'Finish homework', 'completed' => false],
    ['task' => 'Buy groceries', 'completed' => true],
];

echo "<h3>Task List</h3>";
foreach ($tasks as $task) {
    echo $task['task'] . ($task['completed'] ? ' (Completed)' : ' (Pending)') . "<br>";
}

// ============================
// 61. Simple Blog with Comments
// ============================
$posts = [
    ['title' => 'My First Post', 'content' => 'This is the content of the first post.', 'comments' => []],
    ['title' => 'Another Post', 'content' => 'Content for the second post.', 'comments' => ['Great post!', 'Very informative.']],
];

foreach ($posts as $post) {
    echo "<h2>" . $post['title'] . "</h2>";
    echo "<p>" . $post['content'] . "</p>";
    echo "<h3>Comments:</h3>";
    foreach ($post['comments'] as $comment) {
        echo "<p>$comment</p>";
    }
}

// ============================
// 62. Appointment Scheduling System
// ============================
$appointments = [
    ['date' => '2024-11-30', 'time' => '10:00 AM', 'client' => 'John Doe'],
    ['date' => '2024-12-01', 'time' => '2:00 PM', 'client' => 'Jane Smith'],
];

echo "<h3>Upcoming Appointments</h3>";
foreach ($appointments as $appointment) {
    echo $appointment['date'] . " " . $appointment['time'] . " - " . $appointment['client'] . "<br>";
}

// ============================
// 63. Product Review System
// ============================
$product = 'Laptop';
$reviews = [
    ['user' => 'Alice', 'rating' => 4, 'comment' => 'Great product!'],
    ['user' => 'Bob', 'rating' => 5, 'comment' => 'Excellent quality!'],
];

echo "<h3>Reviews for $product</h3>";
foreach ($reviews as $review) {
    echo $review['user'] . " rated: " . $review['rating'] . "/5<br>";
    echo "Comment: " . $review['comment'] . "<br><br>";
}

// ============================
// 64. Feedback System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $message = $_POST['message'];
    echo "Thank you for your feedback, $name. Your message: $message";
}
?>
<form method="POST">
    Your Name: <input type="text" name="name"><br>
    Your Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Submit Feedback">
</form>

// ============================
// 65. File Upload System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $target_dir = "uploads/";
    $target_file = $target_dir . basename($_FILES['file']['name']);
    if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) {
        echo "The file " . basename($_FILES['file']['name']) . " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}
?>
<form method="POST" enctype="multipart/form-data">
    Select file: <input type="file" name="file"><br>
    <input type="submit" value="Upload File">
</form>

// ============================
// 66. Simple Quiz App
// ============================
$questions = [
    'What is the capital of France?' => ['Paris', 'London', 'Berlin', 0],
    'What is 2 + 2?' => ['3', '4', '5', 1],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $score = 0;
    foreach ($_POST['answers'] as $index => $answer) {
        if ($answer == $questions[$index][3]) {
            $score++;
        }
    }
    echo "Your score: $score/" . count($questions);
}
?>
<form method="POST">
    <?php foreach ($questions as $question => $options) : ?>
        <p><?= $question ?></p>
        <?php foreach (array_slice($options, 0, 3) as $index => $option) : ?>
            <input type="radio" name="answers[<?= $question ?>]" value="<?= $index ?>"><?= $option ?><br>
        <?php endforeach; ?>
    <?php endforeach; ?>
    <input type="submit" value="Submit">
</form>

// ============================
// 67. Contact Form with Email Sending
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    mail('admin@example.com', 'Contact Form Submission', $message, "From: $email");
    echo "Thank you for contacting us, $name!";
}
?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Email: <input type="email" name="email"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Submit">
</form>

// ============================
// 68. Image Gallery
// ============================
$images = ['image1.jpg', 'image2.jpg', 'image3.jpg'];
echo "<h3>Image Gallery</h3>";
foreach ($images as $image) {
    echo "<img src='$image' width='200' height='200' style='margin:10px;'>";
}
?>

<?php
// ============================
// 69. Basic CMS (Content Management System)
// ============================
$pages = [
    'home' => 'Welcome to our homepage!',
    'about' => 'This is the about page.',
    'contact' => 'You can contact us here.'
];

$page = $_GET['page'] ?? 'home';
echo "<h1>" . ucfirst($page) . " Page</h1>";
echo $pages[$page];

// ============================
// 70. Online Portfolio
// ============================
$portfolio = [
    ['title' => 'Project 1', 'description' => 'A cool project I worked on.', 'url' => 'project1.html'],
    ['title' => 'Project 2', 'description' => 'Another amazing project!', 'url' => 'project2.html'],
];

echo "<h2>My Portfolio</h2>";
foreach ($portfolio as $item) {
    echo "<h3><a href='" . $item['url'] . "'>" . $item['title'] . "</a></h3>";
    echo "<p>" . $item['description'] . "</p>";
}

// ============================
// 71. File Management System
// ============================
$dir = 'uploads/';
if (!is_dir($dir)) {
    mkdir($dir, 0777, true);
}

echo "<h3>Uploaded Files</h3>";
$files = scandir($dir);
foreach ($files as $file) {
    if ($file != '.' && $file != '..') {
        echo "<a href='$dir/$file'>$file</a><br>";
    }
}

// ============================
// 72. Simple Polling System
// ============================
$poll_options = ['Option A', 'Option B', 'Option C'];
$poll_votes = [0, 0, 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    $poll_votes[$vote]++;
}

echo "<h3>Poll Options</h3>";
foreach ($poll_options as $index => $option) {
    echo "$option: " . $poll_votes[$index] . " votes<br>";
}
?>
<form method="POST">
    <?php foreach ($poll_options as $index => $option) : ?>
        <input type="radio" name="vote" value="<?= $index ?>"><?= $option ?><br>
    <?php endforeach; ?>
    <input type="submit" value="Vote">
</form>

// ============================
// 73. Guestbook System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $message = $_POST['message'];
    echo "<p>Thanks for signing, $name!</p>";
    echo "<p>Your message: $message</p>";
}
?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Sign Guestbook">
</form>

// ============================
// 74. Recipe Sharing System
// ============================
$recipes = [
    ['title' => 'Pasta', 'ingredients' => 'Pasta, Tomato Sauce, Cheese', 'instructions' => 'Boil pasta, add sauce, mix.'],
    ['title' => 'Salad', 'ingredients' => 'Lettuce, Tomato, Cucumber', 'instructions' => 'Chop veggies, mix them together.'],
];

echo "<h3>Recipes</h3>";
foreach ($recipes as $recipe) {
    echo "<h4>" . $recipe['title'] . "</h4>";
    echo "<b>Ingredients:</b> " . $recipe['ingredients'] . "<br>";
    echo "<b>Instructions:</b> " . $recipe['instructions'] . "<br>";
}

// ============================
// 75. Simple Social Media Feed
// ============================
$posts = [
    ['user' => 'John', 'content' => 'Had a great day! #fun'],
    ['user' => 'Jane', 'content' => 'Learning PHP is awesome! #coding'],
];

echo "<h3>Social Media Feed</h3>";
foreach ($posts as $post) {
    echo "<p><b>" . $post['user'] . ":</b> " . $post['content'] . "</p>";
}

// ============================
// 76. To-Do List App
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $task = $_POST['task'];
    file_put_contents('tasks.txt', $task . PHP_EOL, FILE_APPEND);
}

echo "<h3>To-Do List</h3>";
$tasks = file('tasks.txt');
foreach ($tasks as $task) {
    echo "<p>$task</p>";
}
?>
<form method="POST">
    Task: <input type="text" name="task"><br>
    <input type="submit" value="Add Task">
</form>

// ============================
// 77. Simple Chat System
// ============================
$messages = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user = $_POST['user'];
    $message = $_POST['message'];
    $messages[] = "$user: $message";
}

echo "<h3>Chat Messages</h3>";
foreach ($messages as $message) {
    echo "<p>$message</p>";
}
?>
<form method="POST">
    Name: <input type="text" name="user"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Send Message">
</form>

// ============================
// 78. Movie Rating System
// ============================
$movies = [
    ['title' => 'Inception', 'rating' => 4.5],
    ['title' => 'The Dark Knight', 'rating' => 5],
    ['title' => 'Interstellar', 'rating' => 4.8],
];

echo "<h3>Movies</h3>";
foreach ($movies as $movie) {
    echo $movie['title'] . " - Rating: " . $movie['rating'] . "/5<br>";
}

// ============================
// 79. Calendar System
// ============================
$month = $_GET['month'] ?? 'November';
echo "<h3>Calendar for $month</h3>";
echo "<table border='1'>";
echo "<tr><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>";
// Display dummy calendar
echo "<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>";
echo "</table>";

// ============================
// 80. Job Application System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $applicantName = $_POST['name'];
    $applicantEmail = $_POST['email'];
    $applicantResume = $_FILES['resume']['name'];

    move_uploaded_file($_FILES['resume']['tmp_name'], 'uploads/' . $applicantResume);

    echo "Thank you, $applicantName. Your application has been received.";
}

?>
<form method="POST" enctype="multipart/form-data">
    Name: <input type="text" name="name"><br>
    Email: <input type="email" name="email"><br>
    Resume: <input type="file" name="resume"><br>
    <input type="submit" value="Submit Application">
</form>

<?php
// ============================
// 69. Basic CMS (Content Management System)
// ============================
$pages = [
    'home' => 'Welcome to our homepage!',
    'about' => 'This is the about page.',
    'contact' => 'You can contact us here.'
];

$page = $_GET['page'] ?? 'home';
echo "<h1>" . ucfirst($page) . " Page</h1>";
echo $pages[$page];

// ============================
// 70. Online Portfolio
// ============================
$portfolio = [
    ['title' => 'Project 1', 'description' => 'A cool project I worked on.', 'url' => 'project1.html'],
    ['title' => 'Project 2', 'description' => 'Another amazing project!', 'url' => 'project2.html'],
];

echo "<h2>My Portfolio</h2>";
foreach ($portfolio as $item) {
    echo "<h3><a href='" . $item['url'] . "'>" . $item['title'] . "</a></h3>";
    echo "<p>" . $item['description'] . "</p>";
}

// ============================
// 71. File Management System
// ============================
$dir = 'uploads/';
if (!is_dir($dir)) {
    mkdir($dir, 0777, true);
}

echo "<h3>Uploaded Files</h3>";
$files = scandir($dir);
foreach ($files as $file) {
    if ($file != '.' && $file != '..') {
        echo "<a href='$dir/$file'>$file</a><br>";
    }
}

// ============================
// 72. Simple Polling System
// ============================
$poll_options = ['Option A', 'Option B', 'Option C'];
$poll_votes = [0, 0, 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    $poll_votes[$vote]++;
}

echo "<h3>Poll Options</h3>";
foreach ($poll_options as $index => $option) {
    echo "$option: " . $poll_votes[$index] . " votes<br>";
}
?>
<form method="POST">
    <?php foreach ($poll_options as $index => $option) : ?>
        <input type="radio" name="vote" value="<?= $index ?>"><?= $option ?><br>
    <?php endforeach; ?>
    <input type="submit" value="Vote">
</form>

// ============================
// 73. Guestbook System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $message = $_POST['message'];
    echo "<p>Thanks for signing, $name!</p>";
    echo "<p>Your message: $message</p>";
}
?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Sign Guestbook">
</form>

// ============================
// 74. Recipe Sharing System
// ============================
$recipes = [
    ['title' => 'Pasta', 'ingredients' => 'Pasta, Tomato Sauce, Cheese', 'instructions' => 'Boil pasta, add sauce, mix.'],
    ['title' => 'Salad', 'ingredients' => 'Lettuce, Tomato, Cucumber', 'instructions' => 'Chop veggies, mix them together.'],
];

echo "<h3>Recipes</h3>";
foreach ($recipes as $recipe) {
    echo "<h4>" . $recipe['title'] . "</h4>";
    echo "<b>Ingredients:</b> " . $recipe['ingredients'] . "<br>";
    echo "<b>Instructions:</b> " . $recipe['instructions'] . "<br>";
}

// ============================
// 75. Simple Social Media Feed
// ============================
$posts = [
    ['user' => 'John', 'content' => 'Had a great day! #fun'],
    ['user' => 'Jane', 'content' => 'Learning PHP is awesome! #coding'],
];

echo "<h3>Social Media Feed</h3>";
foreach ($posts as $post) {
    echo "<p><b>" . $post['user'] . ":</b> " . $post['content'] . "</p>";
}

// ============================
// 76. To-Do List App
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $task = $_POST['task'];
    file_put_contents('tasks.txt', $task . PHP_EOL, FILE_APPEND);
}

echo "<h3>To-Do List</h3>";
$tasks = file('tasks.txt');
foreach ($tasks as $task) {
    echo "<p>$task</p>";
}
?>
<form method="POST">
    Task: <input type="text" name="task"><br>
    <input type="submit" value="Add Task">
</form>

// ============================
// 77. Simple Chat System
// ============================
$messages = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user = $_POST['user'];
    $message = $_POST['message'];
    $messages[] = "$user: $message";
}

echo "<h3>Chat Messages</h3>";
foreach ($messages as $message) {
    echo "<p>$message</p>";
}
?>
<form method="POST">
    Name: <input type="text" name="user"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Send Message">
</form>

// ============================
// 78. Movie Rating System
// ============================
$movies = [
    ['title' => 'Inception', 'rating' => 4.5],
    ['title' => 'The Dark Knight', 'rating' => 5],
    ['title' => 'Interstellar', 'rating' => 4.8],
];

echo "<h3>Movies</h3>";
foreach ($movies as $movie) {
    echo $movie['title'] . " - Rating: " . $movie['rating'] . "/5<br>";
}

// ============================
// 79. Calendar System
// ============================
$month = $_GET['month'] ?? 'November';
echo "<h3>Calendar for $month</h3>";
echo "<table border='1'>";
echo "<tr><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>";
// Display dummy calendar
echo "<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>";
echo "</table>";

// ============================
// 80. Job Application System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $applicantName = $_POST['name'];
    $applicantEmail = $_POST['email'];
    $applicantResume = $_FILES['resume']['name'];

    move_uploaded_file($_FILES['resume']['tmp_name'], 'uploads/' . $applicantResume);

    echo "Thank you, $applicantName. Your application has been received.";
}

?>
<form method="POST" enctype="multipart/form-data">
    Name: <input type="text" name="name"><br>
    Email: <input type="email" name="email"><br>
    Resume: <input type="file" name="resume"><br>
    <input type="submit" value="Submit Application">
</form>

<?php
// ============================
// 91. Task Management System
// ============================
$tasks = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $task = $_POST['task'];
    $tasks[] = $task;
}

echo "<h3>Task List</h3>";
foreach ($tasks as $task) {
    echo "<p>$task</p>";
}

?>
<form method="POST">
    Task: <input type="text" name="task"><br>
    <input type="submit" value="Add Task">
</form>

// ============================
// 92. To-Do List Application
// ============================
$todo_items = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $todo_item = $_POST['todo_item'];
    $todo_items[] = $todo_item;
}

echo "<h3>To-Do List</h3>";
foreach ($todo_items as $item) {
    echo "<p>$item</p>";
}

?>
<form method="POST">
    To-Do Item: <input type="text" name="todo_item"><br>
    <input type="submit" value="Add Item">
</form>

// ============================
// 93. Simple Inventory System
// ============================
$inventory = [
    ['product' => 'Laptop', 'quantity' => 10],
    ['product' => 'Smartphone', 'quantity' => 20],
    ['product' => 'Headphones', 'quantity' => 50],
];

echo "<h3>Inventory</h3>";
foreach ($inventory as $item) {
    echo "<p>" . $item['product'] . ": " . $item['quantity'] . " units</p>";
}

// ============================
// 94. Event Management System
// ============================
$events = [
    ['name' => 'Music Concert', 'date' => '2024-12-15'],
    ['name' => 'Tech Conference', 'date' => '2024-11-30'],
];

echo "<h3>Upcoming Events</h3>";
foreach ($events as $event) {
    echo "<p>" . $event['name'] . " - Date: " . $event['date'] . "</p>";
}

// ============================
// 95. Simple Blog with Categories
// ============================
$categories = ['Tech', 'Lifestyle', 'Health'];
$posts = [
    ['title' => 'New Tech Trends', 'category' => 'Tech', 'content' => 'Content about new tech trends.'],
    ['title' => 'Healthy Living Tips', 'category' => 'Health', 'content' => 'Content about healthy living.'],
];

echo "<h3>Blog Posts</h3>";
foreach ($categories as $category) {
    echo "<h4>$category</h4>";
    foreach ($posts as $post) {
        if ($post['category'] == $category) {
            echo "<p>" . $post['title'] . ": " . $post['content'] . "</p>";
        }
    }
}

// ============================
// 96. Chat Application
// ============================
$messages = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user = $_POST['user'];
    $message = $_POST['message'];
    $messages[] = ['user' => $user, 'message' => $message];
}

echo "<h3>Chat Room</h3>";
foreach ($messages as $msg) {
    echo "<p><strong>" . $msg['user'] . ":</strong> " . $msg['message'] . "</p>";
}

?>
<form method="POST">
    User: <input type="text" name="user"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Send">
</form>

// ============================
// 97. Appointment Booking System
// ============================
$appointments = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $date = $_POST['date'];
    $appointments[] = ['name' => $name, 'date' => $date];
}

echo "<h3>Appointments</h3>";
foreach ($appointments as $appointment) {
    echo "<p>" . $appointment['name'] . " has an appointment on " . $appointment['date'] . "</p>";
}

?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Date: <input type="date" name="date"><br>
    <input type="submit" value="Book Appointment">
</form>

// ============================
// 98. Voting System
// ============================
$votes = ['Yes' => 0, 'No' => 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    $votes[$vote]++;
}

echo "<h3>Vote on PHP</h3>";
echo "Yes: " . $votes['Yes'] . " votes<br>";
echo "No: " . $votes['No'] . " votes<br>";

?>
<form method="POST">
    <input type="radio" name="vote" value="Yes"> Yes<br>
    <input type="radio" name="vote" value="No"> No<br>
    <input type="submit" value="Vote">
</form>

// ============================
// 99. Online Quiz System
// ============================
$questions = [
    ['question' => 'What is PHP?', 'options' => ['Language', 'Database', 'Server'], 'answer' => 'Language'],
    ['question' => 'Who created PHP?', 'options' => ['Rasmus Lerdorf', 'Mark Zuckerberg', 'Linus Torvalds'], 'answer' => 'Rasmus Lerdorf'],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $score = 0;
    foreach ($questions as $index => $question) {
        if ($_POST['answer' . $index] == $question['answer']) {
            $score++;
        }
    }
    echo "Your score is: $score / " . count($questions);
}

echo "<h3>Quiz</h3>";
foreach ($questions as $index => $question) {
    echo "<h4>" . $question['question'] . "</h4>";
    foreach ($question['options'] as $option) {
        echo "<input type='radio' name='answer$index' value='$option'> $option<br>";
    }
}

?>
<form method="POST">
    <input type="submit" value="Submit">
</form>

// ============================
// 100. Simple Feedback Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $feedback = $_POST['feedback'];
    echo "Thank you for your feedback, $name!";
}

?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Feedback: <textarea name="feedback"></textarea><br>
    <input type="submit" value="Submit Feedback">
</form>
<?php
// ============================
// 101. Online E-commerce Store
// ============================
$products = [
    ['name' => 'Laptop', 'price' => 1000],
    ['name' => 'Smartphone', 'price' => 500],
    ['name' => 'Headphones', 'price' => 100],
];

$total = 0;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $product = $_POST['product'];
    $quantity = $_POST['quantity'];
    $total = $products[$product]['price'] * $quantity;
}

echo "<h3>Products</h3>";
foreach ($products as $index => $product) {
    echo "<p>{$product['name']} - {$product['price']} USD</p>";
}

?>
<form method="POST">
    Product: <select name="product">
        <option value="0">Laptop</option>
        <option value="1">Smartphone</option>
        <option value="2">Headphones</option>
    </select><br>
    Quantity: <input type="number" name="quantity" min="1"><br>
    <input type="submit" value="Calculate Total">
</form>

<?php
if ($total > 0) {
    echo "<h3>Total: $total USD</h3>";
}
?>

// ============================
// 102. Contact Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    echo "Thank you for contacting us, $name!";
}

?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Email: <input type="email" name="email"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Send">
</form>

// ============================
// 103. Simple Calculator
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $num1 = $_POST['num1'];
    $num2 = $_POST['num2'];
    $operator = $_POST['operator'];
    
    if ($operator == 'add') {
        $result = $num1 + $num2;
    } elseif ($operator == 'subtract') {
        $result = $num1 - $num2;
    } elseif ($operator == 'multiply') {
        $result = $num1 * $num2;
    } elseif ($operator == 'divide') {
        $result = $num1 / $num2;
    }
}

?>
<form method="POST">
    Number 1: <input type="number" name="num1"><br>
    Number 2: <input type="number" name="num2"><br>
    Operator: 
    <select name="operator">
        <option value="add">+</option>
        <option value="subtract">-</option>
        <option value="multiply">*</option>
        <option value="divide">/</option>
    </select><br>
    <input type="submit" value="Calculate">
</form>

<?php
if (isset($result)) {
    echo "<h3>Result: $result</h3>";
}
?>

// ============================
// 104. Real-Time Chat Application
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $message = $_POST['message'];
    $chat_messages[] = ['username' => $username, 'message' => $message];
}

echo "<h3>Chat Room</h3>";
foreach ($chat_messages as $msg) {
    echo "<p><strong>" . $msg['username'] . ":</strong> " . $msg['message'] . "</p>";
}

?>
<form method="POST">
    Username: <input type="text" name="username"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Send">
</form>

// ============================
// 105. Admin Login System
// ============================
$users = [
    'admin' => 'password123',
];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];

    if (isset($users[$username]) && $users[$username] == $password) {
        echo "<h3>Welcome Admin</h3>";
    } else {
        echo "<h3>Invalid Login</h3>";
    }
}

?>
<form method="POST">
    Username: <input type="text" name="username"><br>
    Password: <input type="password" name="password"><br>
    <input type="submit" value="Login">
</form>

// ============================
// 106. File Upload System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $file = $_FILES['file'];
    $upload_dir = 'uploads/';
    move_uploaded_file($file['tmp_name'], $upload_dir . $file['name']);
    echo "File uploaded successfully!";
}

?>
<form method="POST" enctype="multipart/form-data">
    Select file: <input type="file" name="file"><br>
    <input type="submit" value="Upload File">
</form>

// ============================
// 107. Currency Converter
// ============================
$currencies = [
    'USD' => 1,
    'EUR' => 0.85,
    'GBP' => 0.75,
];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $amount = $_POST['amount'];
    $currency = $_POST['currency'];
    $converted_amount = $amount * $currencies[$currency];
}

?>
<form method="POST">
    Amount: <input type="number" name="amount"><br>
    Currency: 
    <select name="currency">
        <option value="USD">USD</option>
        <option value="EUR">EUR</option>
        <option value="GBP">GBP</option>
    </select><br>
    <input type="submit" value="Convert">
</form>

<?php
if (isset($converted_amount)) {
    echo "<h3>Converted Amount: $converted_amount</h3>";
}
?>

// ============================
// 108. News Aggregator
// ============================
$news = [
    ['title' => 'Tech Update', 'content' => 'Latest news in tech...'],
    ['title' => 'World News', 'content' => 'Breaking news around the world...'],
    ['title' => 'Sports', 'content' => 'Sports highlights and updates...'],
];

echo "<h3>Latest News</h3>";
foreach ($news as $article) {
    echo "<h4>" . $article['title'] . "</h4>";
    echo "<p>" . $article['content'] . "</p>";
}

// ============================
// 109. Movie Rating System
// ============================
$movies = [
    ['title' => 'Inception', 'rating' => 5],
    ['title' => 'Titanic', 'rating' => 4],
    ['title' => 'The Dark Knight', 'rating' => 5],
];

echo "<h3>Movie Ratings</h3>";
foreach ($movies as $movie) {
    echo "<p>" . $movie['title'] . " - Rating: " . $movie['rating'] . " stars</p>";
}

// ============================
// 110. Online Survey
// ============================
$survey_results = ['Option 1' => 0, 'Option 2' => 0, 'Option 3' => 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    $survey_results[$vote]++;
}

echo "<h3>Survey</h3>";
foreach ($survey_results as $option => $votes) {
    echo "<p>$option: $votes votes</p>";
}

?>
<form method="POST">
    <input type="radio" name="vote" value="Option 1"> Option 1<br>
    <input type="radio" name="vote" value="Option 2"> Option 2<br>
    <input type="radio" name="vote" value="Option 3"> Option 3<br>
    <input type="submit" value="Vote">
</form>
<?php
// ============================
// 111. Simple Blog System
// ============================
$posts = [
    ['title' => 'My First Post', 'content' => 'This is my first blog post!'],
    ['title' => 'Another Blog Post', 'content' => 'More content coming soon...'],
];

echo "<h3>Blog</h3>";
foreach ($posts as $post) {
    echo "<h4>" . $post['title'] . "</h4>";
    echo "<p>" . $post['content'] . "</p>";
}

// ============================
// 112. Simple Poll System
// ============================
$poll_options = ['Yes' => 0, 'No' => 0];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['vote'];
    $poll_options[$vote]++;
}

echo "<h3>Poll: Do you like PHP?</h3>";
foreach ($poll_options as $option => $votes) {
    echo "<p>$option: $votes votes</p>";
}

?>
<form method="POST">
    <input type="radio" name="vote" value="Yes"> Yes<br>
    <input type="radio" name="vote" value="No"> No<br>
    <input type="submit" value="Vote">
</form>

// ============================
// 113. Student Grade Management System
// ============================
$students = [
    ['name' => 'John Doe', 'grade' => 90],
    ['name' => 'Jane Smith', 'grade' => 85],
    ['name' => 'Mark Johnson', 'grade' => 78],
];

echo "<h3>Student Grades</h3>";
foreach ($students as $student) {
    echo "<p>" . $student['name'] . " - Grade: " . $student['grade'] . "</p>";
}

// ============================
// 114. Simple Image Gallery
// ============================
$images = ['image1.jpg', 'image2.jpg', 'image3.jpg'];

echo "<h3>Image Gallery</h3>";
foreach ($images as $image) {
    echo "<img src='$image' alt='Gallery Image' width='200'><br>";
}

// ============================
// 115. To-Do List Application
// ============================
$tasks = ['Task 1', 'Task 2', 'Task 3'];

echo "<h3>To-Do List</h3>";
foreach ($tasks as $task) {
    echo "<p>$task</p>";
}

?>
<form method="POST">
    Task: <input type="text" name="task"><br>
    <input type="submit" value="Add Task">
</form>

// ============================
// 116. Contact Form with Validation
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    
    if (empty($name) || empty($email)) {
        echo "<p style='color:red;'>Please fill in all fields</p>";
    } else {
        echo "<p>Thank you for contacting us, $name!</p>";
    }
}

?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Email: <input type="email" name="email"><br>
    <input type="submit" value="Submit">
</form>

// ============================
// 117. User Registration System
// ============================
$users = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $users[$username] = $password;
    echo "<p>User registered successfully!</p>";
}

?>
<form method="POST">
    Username: <input type="text" name="username"><br>
    Password: <input type="password" name="password"><br>
    <input type="submit" value="Register">
</form>

// ============================
// 118. Simple File Management System
// ============================
$files = ['file1.txt', 'file2.txt', 'file3.txt'];

echo "<h3>Files</h3>";
foreach ($files as $file) {
    echo "<p>$file</p>";
}

// ============================
// 119. Multi-page News Website
// ============================
$categories = ['Tech', 'Sports', 'Entertainment'];
$articles = [
    'Tech' => ['Tech Article 1', 'Tech Article 2'],
    'Sports' => ['Sports Article 1', 'Sports Article 2'],
    'Entertainment' => ['Entertainment Article 1', 'Entertainment Article 2'],
];

echo "<h3>News Website</h3>";
foreach ($categories as $category) {
    echo "<h4>$category</h4>";
    foreach ($articles[$category] as $article) {
        echo "<p>$article</p>";
    }
}

// ============================
// 120. Shopping Cart System
// ============================
$cart = [
    ['product' => 'Laptop', 'price' => 1000, 'quantity' => 1],
    ['product' => 'Smartphone', 'price' => 500, 'quantity' => 2],
];

$total = 0;
foreach ($cart as $item) {
    $total += $item['price'] * $item['quantity'];
}

echo "<h3>Shopping Cart</h3>";
foreach ($cart as $item) {
    echo "<p>" . $item['product'] . " - " . $item['price'] . " USD x " . $item['quantity'] . "</p>";
}

echo "<h3>Total: $total USD</h3>";
?>

// ============================
// 121. PHP Calendar
// ============================
echo "<h3>PHP Calendar</h3>";

$month = date('m');
$year = date('Y');
echo "<table border='1'>";
echo "<tr><th colspan='7'>" . date('F Y', strtotime("$year-$month-01")) . "</th></tr>";
echo "<tr><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>";

$days_in_month = date('t', strtotime("$year-$month-01"));
$first_day_of_month = date('w', strtotime("$year-$month-01"));
$day = 1;

for ($i = 0; $i < 6; $i++) {
    echo "<tr>";
    for ($j = 0; $j < 7; $j++) {
        if (($i == 0 && $j >= $first_day_of_month) || $i > 0) {
            if ($day <= $days_in_month) {
                echo "<td>$day</td>";
                $day++;
            } else {
                echo "<td></td>";
            }
        } else {
            echo "<td></td>";
        }
    }
    echo "</tr>";
}
echo "</table>";
?>
<?php
// ============================
// 122. Online Quiz System
// ============================
$questions = [
    'What is 2 + 2?' => ['answer' => '4', 'options' => ['1', '2', '3', '4']],
    'What is the capital of France?' => ['answer' => 'Paris', 'options' => ['Berlin', 'Madrid', 'Paris', 'Rome']],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $score = 0;
    foreach ($questions as $question => $data) {
        if ($_POST[$question] == $data['answer']) {
            $score++;
        }
    }
    echo "Your score is: $score out of " . count($questions);
}

echo "<h3>Quiz</h3>";
foreach ($questions as $question => $data) {
    echo "<p>$question</p>";
    foreach ($data['options'] as $option) {
        echo "<input type='radio' name='$question' value='$option'> $option<br>";
    }
}
?>
<form method="POST">
    <input type="submit" value="Submit">
</form>

// ============================
// 123. Employee Management System
// ============================
$employees = [
    ['id' => 1, 'name' => 'John Doe', 'position' => 'Manager'],
    ['id' => 2, 'name' => 'Jane Smith', 'position' => 'Developer'],
    ['id' => 3, 'name' => 'Mark Johnson', 'position' => 'Designer'],
];

echo "<h3>Employee List</h3>";
foreach ($employees as $employee) {
    echo "<p>ID: " . $employee['id'] . " - Name: " . $employee['name'] . " - Position: " . $employee['position'] . "</p>";
}

// ============================
// 124. Customer Feedback System
// ============================
$feedback = [];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $message = $_POST['message'];
    $feedback[] = ['name' => $name, 'message' => $message];
}

echo "<h3>Feedback</h3>";
foreach ($feedback as $entry) {
    echo "<p><b>" . $entry['name'] . ":</b> " . $entry['message'] . "</p>";
}

?>
<form method="POST">
    Name: <input type="text" name="name"><br>
    Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Submit Feedback">
</form>

// ============================
// 125. Movie Booking System
// ============================
$movies = [
    ['title' => 'Movie A', 'showtimes' => ['12:00 PM', '03:00 PM', '06:00 PM']],
    ['title' => 'Movie B', 'showtimes' => ['01:00 PM', '04:00 PM', '07:00 PM']],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $movie_title = $_POST['movie'];
    $showtime = $_POST['showtime'];
    echo "<p>You booked $movie_title at $showtime.</p>";
}

echo "<h3>Movie Booking</h3>";
echo "<form method='POST'>";
echo "Select Movie: <select name='movie'>";
foreach ($movies as $movie) {
    echo "<option value='" . $movie['title'] . "'>" . $movie['title'] . "</option>";
}
echo "</select><br>";

echo "Select Showtime: <select name='showtime'>";
foreach ($movies[0]['showtimes'] as $time) {
    echo "<option value='$time'>$time</option>";
}
echo "</select><br>";

echo "<input type='submit' value='Book Now'>";
echo "</form>";

// ============================
// 126. Simple E-Commerce Store
// ============================
$products = [
    ['name' => 'Laptop', 'price' => 1000],
    ['name' => 'Smartphone', 'price' => 500],
    ['name' => 'Tablet', 'price' => 300],
];

$total = 0;
echo "<h3>Product List</h3>";
foreach ($products as $product) {
    echo "<p>" . $product['name'] . " - $" . $product['price'] . "</p>";
    $total += $product['price'];
}

echo "<h3>Total: $" . $total . "</h3>";

// ============================
// 127. Address Book System
// ============================
$contacts = [
    ['name' => 'John Doe', 'phone' => '123-456-7890'],
    ['name' => 'Jane Smith', 'phone' => '987-654-3210'],
];

echo "<h3>Contact List</h3>";
foreach ($contacts as $contact) {
    echo "<p>Name: " . $contact['name'] . " - Phone: " . $contact['phone'] . "</p>";
}

// ============================
// 128. Simple Voting System
// ============================
$candidates = ['Alice', 'Bob', 'Charlie'];
$votes = [0, 0, 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vote = $_POST['candidate'];
    $votes[$vote]++;
}

echo "<h3>Voting</h3>";
foreach ($candidates as $index => $candidate) {
    echo "<input type='radio' name='candidate' value='$index'> $candidate<br>";
}

echo "<p>Total votes for each candidate:</p>";
foreach ($candidates as $index => $candidate) {
    echo "<p>$candidate: " . $votes[$index] . " votes</p>";
}

?>
<form method="POST">
    <input type="submit" value="Vote">
</form>

// ============================
// 129. Password Strength Checker
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $password = $_POST['password'];
    $strength = (strlen($password) >= 8) ? "Strong" : "Weak";
    echo "<p>Password strength: $strength</p>";
}

?>
<form method="POST">
    Enter Password: <input type="password" name="password"><br>
    <input type="submit" value="Check Strength">
</form>

// ============================
// 130. File Upload System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $file = $_FILES['file'];
    move_uploaded_file($file['tmp_name'], 'uploads/' . $file['name']);
    echo "<p>File uploaded successfully!</p>";
}

?>
<form method="POST" enctype="multipart/form-data">
    Select File: <input type="file" name="file"><br>
    <input type="submit" value="Upload File">
</form>
<?php
// ============================
// 131. Online Library Management System
// ============================
$books = [
    ['title' => 'The Great Gatsby', 'author' => 'F. Scott Fitzgerald', 'status' => 'Available'],
    ['title' => '1984', 'author' => 'George Orwell', 'status' => 'Available'],
    ['title' => 'To Kill a Mockingbird', 'author' => 'Harper Lee', 'status' => 'Not Available'],
];

echo "<h3>Library Book List</h3>";
foreach ($books as $book) {
    echo "<p>Title: " . $book['title'] . " - Author: " . $book['author'] . " - Status: " . $book['status'] . "</p>";
}

// ============================
// 132. Task Manager System
// ============================
$tasks = [
    ['task' => 'Complete PHP project', 'status' => 'Incomplete'],
    ['task' => 'Attend meeting', 'status' => 'Complete'],
    ['task' => 'Update website', 'status' => 'Incomplete'],
];

echo "<h3>Task List</h3>";
foreach ($tasks as $task) {
    echo "<p>Task: " . $task['task'] . " - Status: " . $task['status'] . "</p>";
}

// ============================
// 133. Simple Forum System
// ============================
$posts = [
    ['username' => 'user1', 'post' => 'How to learn PHP?', 'date' => '2024-11-01'],
    ['username' => 'user2', 'post' => 'What is MVC in PHP?', 'date' => '2024-11-02'],
];

echo "<h3>Forum Posts</h3>";
foreach ($posts as $post) {
    echo "<p><b>" . $post['username'] . ":</b> " . $post['post'] . " <i>[" . $post['date'] . "]</i></p>";
}

// ============================
// 134. Event Booking System
// ============================
$events = [
    ['event' => 'Music Concert', 'date' => '2024-12-01', 'venue' => 'City Hall'],
    ['event' => 'Tech Conference', 'date' => '2024-12-05', 'venue' => 'Convention Center'],
];

echo "<h3>Upcoming Events</h3>";
foreach ($events as $event) {
    echo "<p>Event: " . $event['event'] . " - Date: " . $event['date'] . " - Venue: " . $event['venue'] . "</p>";
}

// ============================
// 135. Job Portal System
// ============================
$jobs = [
    ['title' => 'Software Developer', 'company' => 'Tech Corp', 'location' => 'Remote'],
    ['title' => 'Web Designer', 'company' => 'Design Studio', 'location' => 'New York'],
];

echo "<h3>Job Listings</h3>";
foreach ($jobs as $job) {
    echo "<p>Job Title: " . $job['title'] . " - Company: " . $job['company'] . " - Location: " . $job['location'] . "</p>";
}

// ============================
// 136. Student Enrollment System
// ============================
$students = [
    ['name' => 'Alice', 'course' => 'PHP Development', 'status' => 'Enrolled'],
    ['name' => 'Bob', 'course' => 'Web Design', 'status' => 'Pending'],
];

echo "<h3>Student Enrollment</h3>";
foreach ($students as $student) {
    echo "<p>Student: " . $student['name'] . " - Course: " . $student['course'] . " - Status: " . $student['status'] . "</p>";
}

// ============================
// 137. Online Restaurant Order System
// ============================
$menu = [
    ['item' => 'Burger', 'price' => 5.99],
    ['item' => 'Pizza', 'price' => 8.99],
    ['item' => 'Pasta', 'price' => 7.49],
];

$orderTotal = 0;
echo "<h3>Menu</h3>";
foreach ($menu as $item) {
    echo "<p>" . $item['item'] . " - $" . $item['price'] . "</p>";
    $orderTotal += $item['price'];
}

echo "<h3>Total Order: $" . $orderTotal . "</h3>";

// ============================
// 138. Online Auction System
// ============================
$items = [
    ['name' => 'Painting', 'starting_bid' => 100, 'current_bid' => 150],
    ['name' => 'Antique Vase', 'starting_bid' => 50, 'current_bid' => 80],
];

echo "<h3>Auction Items</h3>";
foreach ($items as $item) {
    echo "<p>Item: " . $item['name'] . " - Starting Bid: $" . $item['starting_bid'] . " - Current Bid: $" . $item['current_bid'] . "</p>";
}

// ============================
// 139. Personal Finance Tracker
// ============================
$expenses = [
    ['category' => 'Food', 'amount' => 200],
    ['category' => 'Rent', 'amount' => 1200],
    ['category' => 'Utilities', 'amount' => 150],
];

$totalExpenses = 0;
echo "<h3>Monthly Expenses</h3>";
foreach ($expenses as $expense) {
    echo "<p>Category: " . $expense['category'] . " - Amount: $" . $expense['amount'] . "</p>";
    $totalExpenses += $expense['amount'];
}

echo "<h3>Total Expenses: $" . $totalExpenses . "</h3>";

// ============================
// 140. Customer Relationship Management (CRM) System
// ============================
$customers = [
    ['name' => 'John Doe', 'email' => 'john@example.com', 'status' => 'Active'],
    ['name' => 'Jane Smith', 'email' => 'jane@example.com', 'status' => 'Inactive'],
];

echo "<h3>Customer List</h3>";
foreach ($customers as $customer) {
    echo "<p>Name: " . $customer['name'] . " - Email: " . $customer['email'] . " - Status: " . $customer['status'] . "</p>";
}

// ============================
// 141. Online Shopping Cart System
// ============================
$cart = [
    ['product' => 'Laptop', 'price' => 1000],
    ['product' => 'Phone', 'price' => 500],
    ['product' => 'Headphones', 'price' => 150],
];

$totalCost = 0;
echo "<h3>Shopping Cart</h3>";
foreach ($cart as $item) {
    echo "<p>Product: " . $item['product'] . " - Price: $" . $item['price'] . "</p>";
    $totalCost += $item['price'];
}

echo "<h3>Total Cost: $" . $totalCost . "</h3>";

// ============================
// 142. Real-time Chat Application
// ============================
$messages = [
    ['user' => 'Alice', 'message' => 'Hello, how are you?'],
    ['user' => 'Bob', 'message' => 'I am good, thanks! How about you?'],
];

echo "<h3>Chat Room</h3>";
foreach ($messages as $message) {
    echo "<p><b>" . $message['user'] . ":</b> " . $message['message'] . "</p>";
}

// ============================
// 143. Document Management System
// ============================
$documents = [
    ['title' => 'Project Proposal', 'date' => '2024-11-15'],
    ['title' => 'Meeting Notes', 'date' => '2024-11-16'],
];

echo "<h3>Document List</h3>";
foreach ($documents as $document) {
    echo "<p>Title: " . $document['title'] . " - Date: " . $document['date'] . "</p>";
}

// ============================
// 144. Task Tracker
// ============================
$tasksTracker = [
    ['task' => 'Finish report', 'status' => 'Pending'],
    ['task' => 'Call client', 'status' => 'Completed'],
];

echo "<h3>Task Tracker</h3>";
foreach ($tasksTracker as $task) {
    echo "<p>Task: " . $task['task'] . " - Status: " . $task['status'] . "</p>";
}

// ============================
// 145. Membership Registration System
// ============================
$members = [
    ['name' => 'Tom', 'email' => 'tom@example.com'],
    ['name' => 'Sarah', 'email' => 'sarah@example.com'],
];

echo "<h3>Member List</h3>";
foreach ($members as $member) {
    echo "<p>Name: " . $member['name'] . " - Email: " . $member['email'] . "</p>";
}

// ============================
// 146. Real Estate Listing System
// ============================
$properties = [
    ['title' => '2BHK Apartment', 'price' => 200000, 'location' => 'New York'],
    ['title' => '3BHK Villa', 'price' => 350000, 'location' => 'Los Angeles'],
];

echo "<h3>Real Estate Listings</h3>";
foreach ($properties as $property) {
    echo "<p>Title: " . $property['title'] . " - Price: $" . $property['price'] . " - Location: " . $property['location'] . "</p>";
}

// ============================
// 147. Appointment Booking System
// ============================
$appointments = [
    ['service' => 'Haircut', 'date' => '2024-11-20'],
    ['service' => 'Massage', 'date' => '2024-11-22'],
];

echo "<h3>Appointment Schedule</h3>";
foreach ($appointments as $appointment) {
    echo "<p>Service: " . $appointment['service'] . " - Date: " . $appointment['date'] . "</p>";
}
?>
<?php
// ============================
// 148. News Portal System
// ============================
$articles = [
    ['title' => 'Tech News Today', 'content' => 'New advancements in AI technology...', 'date' => '2024-11-19'],
    ['title' => 'Market Trends', 'content' => 'Stock market hits new highs...', 'date' => '2024-11-18'],
];

echo "<h3>Latest News</h3>";
foreach ($articles as $article) {
    echo "<p><b>" . $article['title'] . ":</b> " . $article['content'] . " <i>[" . $article['date'] . "]</i></p>";
}

// ============================
// 149. Online Quiz System
// ============================
$questions = [
    ['question' => 'What is the capital of France?', 'options' => ['Paris', 'London', 'Berlin'], 'answer' => 'Paris'],
    ['question' => 'What is 2+2?', 'options' => ['3', '4', '5'], 'answer' => '4'],
];

echo "<h3>Online Quiz</h3>";
foreach ($questions as $question) {
    echo "<p><b>" . $question['question'] . "</b></p>";
    foreach ($question['options'] as $option) {
        echo "<p>" . $option . "</p>";
    }
}

// ============================
// 150. E-Commerce Product Display
// ============================
$products = [
    ['name' => 'Smartphone', 'price' => 599.99, 'category' => 'Electronics'],
    ['name' => 'Laptop', 'price' => 999.99, 'category' => 'Electronics'],
];

echo "<h3>Products for Sale</h3>";
foreach ($products as $product) {
    echo "<p>Name: " . $product['name'] . " - Price: $" . $product['price'] . " - Category: " . $product['category'] . "</p>";
}

// ============================
// 151. Restaurant Reservation System
// ============================
$reservations = [
    ['name' => 'John', 'date' => '2024-12-01', 'time' => '7:00 PM'],
    ['name' => 'Jane', 'date' => '2024-12-02', 'time' => '8:00 PM'],
];

echo "<h3>Reservations</h3>";
foreach ($reservations as $reservation) {
    echo "<p>Name: " . $reservation['name'] . " - Date: " . $reservation['date'] . " - Time: " . $reservation['time'] . "</p>";
}

// ============================
// 152. File Upload System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $fileName = $_FILES['file']['name'];
    $fileTmpName = $_FILES['file']['tmp_name'];
    $fileDest = 'uploads/' . $fileName;
    move_uploaded_file($fileTmpName, $fileDest);
    echo "<p>File uploaded: " . $fileName . "</p>";
} else {
    echo '<form action="" method="post" enctype="multipart/form-data">
            <input type="file" name="file" />
            <input type="submit" value="Upload File" />
          </form>';
}

// ============================
// 153. Online Poll System
// ============================
$poll = [
    'question' => 'What is your favorite programming language?',
    'options' => ['PHP', 'JavaScript', 'Python', 'Ruby'],
];

echo "<h3>Poll</h3>";
echo "<p>" . $poll['question'] . "</p>";
foreach ($poll['options'] as $option) {
    echo "<p><input type='radio' name='poll' value='" . $option . "'> " . $option . "</p>";
}

// ============================
// 154. Calendar Event System
// ============================
$events = [
    ['event' => 'Team Meeting', 'date' => '2024-11-20'],
    ['event' => 'Birthday Party', 'date' => '2024-11-22'],
];

echo "<h3>Upcoming Events</h3>";
foreach ($events as $event) {
    echo "<p>Event: " . $event['event'] . " - Date: " . $event['date'] . "</p>";
}

// ============================
// 155. Address Book System
// ============================
$contacts = [
    ['name' => 'Alice', 'phone' => '123-456-7890', 'email' => 'alice@example.com'],
    ['name' => 'Bob', 'phone' => '987-654-3210', 'email' => 'bob@example.com'],
];

echo "<h3>Contact List</h3>";
foreach ($contacts as $contact) {
    echo "<p>Name: " . $contact['name'] . " - Phone: " . $contact['phone'] . " - Email: " . $contact['email'] . "</p>";
}

// ============================
// 156. Image Gallery System
// ============================
$images = [
    'image1.jpg', 'image2.jpg', 'image3.jpg'
];

echo "<h3>Image Gallery</h3>";
foreach ($images as $image) {
    echo "<img src='images/" . $image . "' alt='" . $image . "' style='width: 100px; height: 100px; margin: 10px;'>";
}

// ============================
// 157. Job Application System
// ============================
$applications = [
    ['name' => 'John', 'position' => 'Software Developer', 'status' => 'Under Review'],
    ['name' => 'Alice', 'position' => 'Designer', 'status' => 'Accepted'],
];

echo "<h3>Job Applications</h3>";
foreach ($applications as $application) {
    echo "<p>Name: " . $application['name'] . " - Position: " . $application['position'] . " - Status: " . $application['status'] . "</p>";
}

// ============================
// 158. Contact Us Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    echo "<p>Thank you for contacting us, " . $name . "!</p>";
} else {
    echo '<form action="" method="post">
            Name: <input type="text" name="name" /><br>
            Email: <input type="email" name="email" /><br>
            Message: <textarea name="message"></textarea><br>
            <input type="submit" value="Submit" />
          </form>';
}

// ============================
// 159. Online Voting System
// ============================
$candidates = [
    'Alice' => 0,
    'Bob' => 0,
];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote'])) {
    $vote = $_POST['vote'];
    $candidates[$vote]++;
    echo "<p>Your vote for " . $vote . " has been recorded.</p>";
}

echo "<h3>Vote for Your Candidate</h3>";
foreach ($candidates as $candidate => $votes) {
    echo "<p>" . $candidate . " - Votes: " . $votes . " <input type='radio' name='vote' value='" . $candidate . "'> Vote</p>";
}

echo '<form action="" method="post"><input type="submit" value="Submit Vote" /></form>';

// ============================
// 160. Simple Feedback System
// ============================
$feedbacks = [
    ['name' => 'John', 'feedback' => 'Great service!'],
    ['name' => 'Alice', 'feedback' => 'Good experience overall.'],
];

echo "<h3>Feedback</h3>";
foreach ($feedbacks as $feedback) {
    echo "<p><b>" . $feedback['name'] . ":</b> " . $feedback['feedback'] . "</p>";
}

// ============================
// 161. Guestbook System
// ============================
$guests = [
    ['name' => 'John', 'message' => 'Nice website!'],
    ['name' => 'Sarah', 'message' => 'Great experience!'],
];

echo "<h3>Guestbook</h3>";
foreach ($guests as $guest) {
    echo "<p><b>" . $guest['name'] . ":</b> " . $guest['message'] . "</p>";
}
?>
<?php
// ============================
// 162. Currency Converter System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['amount'])) {
    $amount = $_POST['amount'];
    $fromCurrency = $_POST['fromCurrency'];
    $toCurrency = $_POST['toCurrency'];
    
    // Exchange rates for demo purposes
    $exchangeRates = [
        'USD' => 1,
        'EUR' => 0.85,
        'GBP' => 0.75,
    ];
    
    $convertedAmount = $amount * ($exchangeRates[$toCurrency] / $exchangeRates[$fromCurrency]);
    echo "<p>Converted Amount: " . $convertedAmount . " " . $toCurrency . "</p>";
} else {
    echo '<form action="" method="post">
            Amount: <input type="number" name="amount" /><br>
            From: <select name="fromCurrency">
                    <option value="USD">USD</option>
                    <option value="EUR">EUR</option>
                    <option value="GBP">GBP</option>
                  </select><br>
            To: <select name="toCurrency">
                    <option value="USD">USD</option>
                    <option value="EUR">EUR</option>
                    <option value="GBP">GBP</option>
                  </select><br>
            <input type="submit" value="Convert" />
          </form>';
}

// ============================
// 163. Personal Budget Tracker
// ============================
$expenses = [
    ['item' => 'Groceries', 'amount' => 50],
    ['item' => 'Electricity Bill', 'amount' => 30],
];

echo "<h3>Your Expenses</h3>";
$totalExpenses = 0;
foreach ($expenses as $expense) {
    echo "<p>" . $expense['item'] . ": $" . $expense['amount'] . "</p>";
    $totalExpenses += $expense['amount'];
}

echo "<p><b>Total Expenses: $" . $totalExpenses . "</b></p>";

// ============================
// 164. File Manager System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $fileName = $_FILES['file']['name'];
    $fileTmpName = $_FILES['file']['tmp_name'];
    $fileDest = 'uploads/' . $fileName;
    move_uploaded_file($fileTmpName, $fileDest);
    echo "<p>File uploaded: " . $fileName . "</p>";
}

echo '<h3>Upload a File</h3>';
echo '<form action="" method="post" enctype="multipart/form-data">
        <input type="file" name="file" />
        <input type="submit" value="Upload" />
      </form>';

// ============================
// 165. Subscription Management System
// ============================
$subscriptions = [
    ['name' => 'Netflix', 'price' => 15.99, 'status' => 'Active'],
    ['name' => 'Spotify', 'price' => 9.99, 'status' => 'Inactive'],
];

echo "<h3>Your Subscriptions</h3>";
foreach ($subscriptions as $subscription) {
    echo "<p>Name: " . $subscription['name'] . " - Price: $" . $subscription['price'] . " - Status: " . $subscription['status'] . "</p>";
}

// ============================
// 166. Recipe Book System
// ============================
$recipes = [
    ['name' => 'Spaghetti', 'ingredients' => 'Pasta, Tomato Sauce, Garlic, Onion'],
    ['name' => 'Grilled Chicken', 'ingredients' => 'Chicken, Salt, Pepper, Olive Oil'],
];

echo "<h3>Recipe Book</h3>";
foreach ($recipes as $recipe) {
    echo "<p><b>" . $recipe['name'] . ":</b> Ingredients: " . $recipe['ingredients'] . "</p>";
}

// ============================
// 167. Event Ticket Booking System
// ============================
$tickets = [
    ['event' => 'Concert', 'price' => 50, 'seats' => 100],
    ['event' => 'Theater Show', 'price' => 30, 'seats' => 50],
];

echo "<h3>Event Tickets</h3>";
foreach ($tickets as $ticket) {
    echo "<p>Event: " . $ticket['event'] . " - Price: $" . $ticket['price'] . " - Available Seats: " . $ticket['seats'] . "</p>";
}

// ============================
// 168. Blog Post System
// ============================
$blogPosts = [
    ['title' => 'PHP for Beginners', 'content' => 'This post covers the basics of PHP...', 'author' => 'John Doe', 'date' => '2024-11-18'],
    ['title' => 'Advanced PHP Techniques', 'content' => 'This post explores some advanced PHP concepts...', 'author' => 'Jane Smith', 'date' => '2024-11-17'],
];

echo "<h3>Blog Posts</h3>";
foreach ($blogPosts as $post) {
    echo "<p><b>" . $post['title'] . ":</b> " . $post['content'] . " <i>by " . $post['author'] . " on " . $post['date'] . "</i></p>";
}

// ============================
// 169. To-Do List System
// ============================
$tasks = [
    ['task' => 'Finish homework', 'status' => 'Pending'],
    ['task' => 'Buy groceries', 'status' => 'Completed'],
];

echo "<h3>To-Do List</h3>";
foreach ($tasks as $task) {
    echo "<p>Task: " . $task['task'] . " - Status: " . $task['status'] . "</p>";
}

// ============================
// 170. Feedback Collection System
// ============================
$feedbacks = [
    ['user' => 'Alice', 'rating' => 5, 'feedback' => 'Excellent service!'],
    ['user' => 'Bob', 'rating' => 4, 'feedback' => 'Good, but could be improved.'],
];

echo "<h3>Customer Feedback</h3>";
foreach ($feedbacks as $feedback) {
    echo "<p>User: " . $feedback['user'] . " - Rating: " . $feedback['rating'] . "/5 - Feedback: " . $feedback['feedback'] . "</p>";
}

// ============================
// 171. Online Ticket Reservation
// ============================
$reservations = [
    ['event' => 'Movie', 'seats' => 2, 'date' => '2024-12-10'],
    ['event' => 'Concert', 'seats' => 4, 'date' => '2024-12-15'],
];

echo "<h3>Reservations</h3>";
foreach ($reservations as $reservation) {
    echo "<p>Event: " . $reservation['event'] . " - Seats: " . $reservation['seats'] . " - Date: " . $reservation['date'] . "</p>";
}

// ============================
// 172. URL Shortener System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['url'])) {
    $url = $_POST['url'];
    $shortenedUrl = substr(md5($url), 0, 6); // Simple shortening logic
    echo "<p>Shortened URL: <a href='" . $url . "'>" . $shortenedUrl . "</a></p>";
} else {
    echo '<form action="" method="post">
            URL: <input type="text" name="url" />
            <input type="submit" value="Shorten" />
          </form>';
}

// ============================
// 173. Password Strength Checker
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['password'])) {
    $password = $_POST['password'];
    $strength = 'Weak';

    if (strlen($password) >= 8 && preg_match('/[A-Z]/', $password) && preg_match('/\d/', $password)) {
        $strength = 'Strong';
    } elseif (strlen($password) >= 6) {
        $strength = 'Medium';
    }

    echo "<p>Password strength: " . $strength . "</p>";
} else {
    echo '<form action="" method="post">
            Password: <input type="password" name="password" />
            <input type="submit" value="Check Strength" />
          </form>';
}
?>
<?php
// ============================
// 174. Email Subscription System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['email'])) {
    $email = $_POST['email'];
    // Add email to subscription list (for demo purposes, storing in an array)
    $subscribers[] = $email;
    echo "<p>Subscribed successfully!</p>";
} else {
    echo '<form action="" method="post">
            Email: <input type="email" name="email" required />
            <input type="submit" value="Subscribe" />
          </form>';
}

// ============================
// 175. Real-Time Chat System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['message'])) {
    $message = $_POST['message'];
    // For demo, storing messages in a session
    session_start();
    $_SESSION['messages'][] = $message;
}

echo "<h3>Chat Messages</h3>";
if (isset($_SESSION['messages'])) {
    foreach ($_SESSION['messages'] as $message) {
        echo "<p>" . $message . "</p>";
    }
}
echo '<form action="" method="post">
        Message: <input type="text" name="message" required />
        <input type="submit" value="Send" />
      </form>';

// ============================
// 176. Quiz Application
// ============================
$questions = [
    ['question' => 'What is PHP?', 'options' => ['A scripting language', 'A programming language', 'A database'], 'answer' => 'A scripting language'],
    ['question' => 'What does HTML stand for?', 'options' => ['HyperText Markup Language', 'Hyper Transfer Markup Language', 'Home Tool Markup Language'], 'answer' => 'HyperText Markup Language'],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['answers'])) {
    $answers = $_POST['answers'];
    $score = 0;

    foreach ($answers as $key => $answer) {
        if ($answer == $questions[$key]['answer']) {
            $score++;
        }
    }
    echo "<p>Your score: " . $score . "/" . count($questions) . "</p>";
} else {
    echo "<h3>Quiz</h3>";
    echo '<form action="" method="post">';
    foreach ($questions as $key => $question) {
        echo "<p>" . $question['question'] . "</p>";
        foreach ($question['options'] as $option) {
            echo '<input type="radio" name="answers[' . $key . ']" value="' . $option . '" required /> ' . $option . '<br>';
        }
    }
    echo '<input type="submit" value="Submit Quiz" />';
    echo '</form>';
}

// ============================
// 177. Poll Voting System
// ============================
$options = ['Option A', 'Option B', 'Option C'];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote'])) {
    $vote = $_POST['vote'];
    // For demo, storing votes in a session
    session_start();
    $_SESSION['votes'][$vote]++;
    echo "<p>Vote submitted successfully!</p>";
}

echo "<h3>Vote for your favorite option:</h3>";
echo '<form action="" method="post">';
foreach ($options as $option) {
    echo '<input type="radio" name="vote" value="' . $option . '" required /> ' . $option . '<br>';
}
echo '<input type="submit" value="Vote" />';
echo '</form>';

// ============================
// 178. Blog Comment System
// ============================
$comments = [
    ['user' => 'John', 'comment' => 'Great post!'],
    ['user' => 'Jane', 'comment' => 'Very informative. Thanks for sharing!'],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['comment'])) {
    $user = 'Guest';
    $comment = $_POST['comment'];
    // Adding the comment
    $comments[] = ['user' => $user, 'comment' => $comment];
}

echo "<h3>Comments:</h3>";
foreach ($comments as $comment) {
    echo "<p><b>" . $comment['user'] . ":</b> " . $comment['comment'] . "</p>";
}

echo '<form action="" method="post">
        Comment: <textarea name="comment" required></textarea><br>
        <input type="submit" value="Add Comment" />
      </form>';

// ============================
// 179. Task Reminder System
// ============================
$tasks = [
    ['task' => 'Buy groceries', 'due' => '2024-11-20'],
    ['task' => 'Complete homework', 'due' => '2024-11-21'],
];

echo "<h3>Your Tasks</h3>";
foreach ($tasks as $task) {
    echo "<p>Task: " . $task['task'] . " - Due: " . $task['due'] . "</p>";
}

// ============================
// 180. Social Media Feed System
// ============================
$posts = [
    ['user' => 'Alice', 'content' => 'Had a great day!', 'date' => '2024-11-19'],
    ['user' => 'Bob', 'content' => 'Check out this cool project I made!', 'date' => '2024-11-18'],
];

echo "<h3>Recent Posts</h3>";
foreach ($posts as $post) {
    echo "<p><b>" . $post['user'] . ":</b> " . $post['content'] . " <i>on " . $post['date'] . "</i></p>";
}

// ============================
// 181. Library System
// ============================
$books = [
    ['title' => 'To Kill a Mockingbird', 'author' => 'Harper Lee', 'status' => 'Available'],
    ['title' => '1984', 'author' => 'George Orwell', 'status' => 'Checked Out'],
];

echo "<h3>Library Books</h3>";
foreach ($books as $book) {
    echo "<p>Title: " . $book['title'] . " - Author: " . $book['author'] . " - Status: " . $book['status'] . "</p>";
}

// ============================
// 182. Admin Panel for CRUD Operations
// ============================
$users = [
    ['username' => 'admin', 'email' => 'admin@example.com'],
    ['username' => 'user1', 'email' => 'user1@example.com'],
];

echo "<h3>Manage Users</h3>";
foreach ($users as $user) {
    echo "<p>Username: " . $user['username'] . " - Email: " . $user['email'] . "</p>";
}

echo '<form action="" method="post">
        Username: <input type="text" name="username" required /><br>
        Email: <input type="email" name="email" required /><br>
        <input type="submit" value="Add User" />
      </form>';
?>
<?php
// ============================
// 183. Contact Form System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['email'], $_POST['message'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    // Send an email to the admin (for demo purposes, we'll just print it)
    echo "<p>Thank you for your message, $name! We will get back to you soon.</p>";
} else {
    echo '<form action="" method="post">
            Name: <input type="text" name="name" required /><br>
            Email: <input type="email" name="email" required /><br>
            Message: <textarea name="message" required></textarea><br>
            <input type="submit" value="Send Message" />
          </form>';
}

// ============================
// 184. Simple File Upload System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $file = $_FILES['file'];
    $upload_dir = 'uploads/';
    $upload_path = $upload_dir . basename($file['name']);

    if (move_uploaded_file($file['tmp_name'], $upload_path)) {
        echo "<p>File uploaded successfully!</p>";
    } else {
        echo "<p>File upload failed!</p>";
    }
} else {
    echo '<form action="" method="post" enctype="multipart/form-data">
            Select a file: <input type="file" name="file" required /><br>
            <input type="submit" value="Upload File" />
          </form>';
}

// ============================
// 185. Currency Converter
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['amount'], $_POST['currency'])) {
    $amount = $_POST['amount'];
    $currency = $_POST['currency'];
    $conversion_rate = 1.2; // Example rate for conversion

    $converted_amount = $amount * $conversion_rate;
    echo "<p>Converted Amount: $converted_amount $currency</p>";
} else {
    echo '<form action="" method="post">
            Amount: <input type="number" name="amount" required /><br>
            Currency: <input type="text" name="currency" required /><br>
            <input type="submit" value="Convert" />
          </form>';
}

// ============================
// 186. Simple Login System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username'], $_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    // Simple validation (for demo purposes)
    if ($username == 'admin' && $password == 'password') {
        echo "<p>Welcome, $username!</p>";
    } else {
        echo "<p>Invalid username or password!</p>";
    }
} else {
    echo '<form action="" method="post">
            Username: <input type="text" name="username" required /><br>
            Password: <input type="password" name="password" required /><br>
            <input type="submit" value="Login" />
          </form>';
}

// ============================
// 187. Simple To-Do List
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['task'])) {
    $task = $_POST['task'];

    // Store tasks in a session (for demo purposes)
    session_start();
    $_SESSION['tasks'][] = $task;
    echo "<p>Task added successfully!</p>";
} else {
    echo "<h3>To-Do List</h3>";

    if (isset($_SESSION['tasks'])) {
        foreach ($_SESSION['tasks'] as $task) {
            echo "<p>- $task</p>";
        }
    }

    echo '<form action="" method="post">
            Task: <input type="text" name="task" required /><br>
            <input type="submit" value="Add Task" />
          </form>';
}

// ============================
// 188. Product Search System
// ============================
$products = [
    ['name' => 'Laptop', 'price' => '$1000'],
    ['name' => 'Phone', 'price' => '$500'],
    ['name' => 'Tablet', 'price' => '$300'],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['search'])) {
    $search = strtolower($_POST['search']);
    $filtered_products = array_filter($products, function($product) use ($search) {
        return strpos(strtolower($product['name']), $search) !== false;
    });

    echo "<h3>Search Results:</h3>";
    if ($filtered_products) {
        foreach ($filtered_products as $product) {
            echo "<p>Name: " . $product['name'] . " - Price: " . $product['price'] . "</p>";
        }
    } else {
        echo "<p>No products found.</p>";
    }
} else {
    echo '<form action="" method="post">
            Search Product: <input type="text" name="search" required /><br>
            <input type="submit" value="Search" />
          </form>';
}

// ============================
// 189. Admin Dashboard
// ============================
echo "<h3>Admin Dashboard</h3>";
echo "<p>Welcome to the admin panel!</p>";
echo "<p><a href='admin-users.php'>Manage Users</a></p>";
echo "<p><a href='admin-settings.php'>Settings</a></p>";
echo "<p><a href='logout.php'>Logout</a></p>";

// ============================
// 190. Newsletter System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['email'])) {
    $email = $_POST['email'];
    echo "<p>Thank you for subscribing to our newsletter, $email!</p>";
} else {
    echo '<form action="" method="post">
            Email: <input type="email" name="email" required /><br>
            <input type="submit" value="Subscribe" />
          </form>';
}

// ============================
// 191. Event Booking System
// ============================
$events = [
    ['title' => 'PHP Workshop', 'date' => '2024-12-01'],
    ['title' => 'Web Development Conference', 'date' => '2024-12-15'],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['event'])) {
    $event = $_POST['event'];
    echo "<p>You have successfully booked for the event: $event</p>";
} else {
    echo "<h3>Available Events</h3>";
    foreach ($events as $event) {
        echo "<p>" . $event['title'] . " - Date: " . $event['date'] . "</p>";
    }
    echo '<form action="" method="post">
            Select Event: <select name="event" required>
                            <option value="PHP Workshop">PHP Workshop</option>
                            <option value="Web Development Conference">Web Development Conference</option>
                          </select><br>
            <input type="submit" value="Book Event" />
          </form>';
}

// ============================
// 192. Simple Blogging Platform
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['title'], $_POST['content'])) {
    $title = $_POST['title'];
    $content = $_POST['content'];
    echo "<h3>New Blog Post</h3>";
    echo "<h4>$title</h4>";
    echo "<p>$content</p>";
} else {
    echo '<form action="" method="post">
            Title: <input type="text" name="title" required /><br>
            Content: <textarea name="content" required></textarea><br>
            <input type="submit" value="Publish Post" />
          </form>';
}

?>
<?php
// ============================
// 193. User Profile System
// ============================
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username'], $_POST['email'], $_POST['bio'])) {
    $_SESSION['username'] = $_POST['username'];
    $_SESSION['email'] = $_POST['email'];
    $_SESSION['bio'] = $_POST['bio'];

    echo "<p>Profile updated successfully!</p>";
} else {
    if (isset($_SESSION['username'])) {
        echo "<h3>Welcome, " . $_SESSION['username'] . "</h3>";
        echo "<p>Email: " . $_SESSION['email'] . "</p>";
        echo "<p>Bio: " . $_SESSION['bio'] . "</p>";
    }

    echo '<form action="" method="post">
            Username: <input type="text" name="username" required /><br>
            Email: <input type="email" name="email" required /><br>
            Bio: <textarea name="bio" required></textarea><br>
            <input type="submit" value="Update Profile" />
          </form>';
}

// ============================
// 194. Simple Feedback System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['feedback'])) {
    $feedback = $_POST['feedback'];
    echo "<p>Thank you for your feedback: $feedback</p>";
} else {
    echo '<form action="" method="post">
            Your Feedback: <textarea name="feedback" required></textarea><br>
            <input type="submit" value="Submit Feedback" />
          </form>';
}

// ============================
// 195. Simple Blog Post System with Comments
// ============================
$posts = [
    ['title' => 'PHP Basics', 'content' => 'Learn the basics of PHP.', 'comments' => []],
    ['title' => 'Advanced PHP', 'content' => 'Dive into advanced PHP topics.', 'comments' => []],
];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['comment'], $_POST['post_id'])) {
    $comment = $_POST['comment'];
    $post_id = $_POST['post_id'];
    $posts[$post_id]['comments'][] = $comment;
    echo "<p>Comment added successfully!</p>";
}

foreach ($posts as $post_id => $post) {
    echo "<h3>" . $post['title'] . "</h3>";
    echo "<p>" . $post['content'] . "</p>";

    echo "<h4>Comments:</h4>";
    foreach ($post['comments'] as $comment) {
        echo "<p>$comment</p>";
    }

    echo '<form action="" method="post">
            Comment: <textarea name="comment" required></textarea><br>
            <input type="hidden" name="post_id" value="' . $post_id . '" />
            <input type="submit" value="Add Comment" />
          </form>';
}

// ============================
// 196. Simple Polling System
// ============================
$options = ['Option 1', 'Option 2', 'Option 3'];
$votes = [0, 0, 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote'])) {
    $vote = $_POST['vote'];
    $votes[$vote]++;
    echo "<p>Thank you for voting!</p>";
}

echo "<h3>Poll: What is your favorite option?</h3>";

foreach ($options as $index => $option) {
    echo "<p>$option - Votes: " . $votes[$index] . "</p>";
}

echo '<form action="" method="post">
        <label>Select your vote:</label><br>
        <input type="radio" name="vote" value="0" required /> Option 1<br>
        <input type="radio" name="vote" value="1" required /> Option 2<br>
        <input type="radio" name="vote" value="2" required /> Option 3<br>
        <input type="submit" value="Vote" />
      </form>';

// ============================
// 197. Basic Task Manager
// ============================
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['task'])) {
    $_SESSION['tasks'][] = $_POST['task'];
}

echo "<h3>Your Tasks:</h3>";
if (isset($_SESSION['tasks'])) {
    foreach ($_SESSION['tasks'] as $task) {
        echo "<p>- $task</p>";
    }
}

echo '<form action="" method="post">
        Task: <input type="text" name="task" required /><br>
        <input type="submit" value="Add Task" />
      </form>';

// ============================
// 198. User Registration with Email Confirmation
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['email'], $_POST['password'])) {
    $email = $_POST['email'];
    $password = $_POST['password'];

    // Here, send confirmation email (for demo, we'll just simulate it)
    echo "<p>A confirmation email has been sent to $email!</p>";
    // Send email to user here...
} else {
    echo '<form action="" method="post">
            Email: <input type="email" name="email" required /><br>
            Password: <input type="password" name="password" required /><br>
            <input type="submit" value="Register" />
          </form>';
}

// ============================
// 199. Dynamic Price Calculator
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['quantity'], $_POST['unit_price'])) {
    $quantity = $_POST['quantity'];
    $unit_price = $_POST['unit_price'];

    $total_price = $quantity * $unit_price;
    echo "<p>Total Price: $$total_price</p>";
} else {
    echo '<form action="" method="post">
            Quantity: <input type="number" name="quantity" required /><br>
            Unit Price: <input type="number" name="unit_price" required /><br>
            <input type="submit" value="Calculate Price" />
          </form>';
}

// ============================
// 200. Simple Subscription System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['subscription'])) {
    $subscription = $_POST['subscription'];
    echo "<p>You have successfully subscribed to the $subscription plan!</p>";
} else {
    echo '<form action="" method="post">
            Select Subscription Plan: <br>
            <input type="radio" name="subscription" value="Basic" required /> Basic Plan - $10/month<br>
            <input type="radio" name="subscription" value="Premium" required /> Premium Plan - $20/month<br>
            <input type="submit" value="Subscribe" />
          </form>';
}
?>
<?php
// ============================
// 201. Simple Content Management System (CMS)
// ============================
$articles = [
    ['title' => 'How to Learn PHP', 'content' => 'Learn PHP from scratch with simple tutorials.'],
    ['title' => 'PHP Best Practices', 'content' => 'Follow these best practices for cleaner and more efficient code.'],
];

echo "<h3>Articles</h3>";

foreach ($articles as $article) {
    echo "<h4>" . $article['title'] . "</h4>";
    echo "<p>" . $article['content'] . "</p>";
}

// ============================
// 202. Simple E-commerce Product Page
// ============================
$products = [
    ['name' => 'Product 1', 'price' => 29.99],
    ['name' => 'Product 2', 'price' => 49.99],
    ['name' => 'Product 3', 'price' => 19.99],
];

echo "<h3>Products</h3>";

foreach ($products as $product) {
    echo "<h4>" . $product['name'] . "</h4>";
    echo "<p>Price: $" . $product['price'] . "</p>";
    echo "<button>Add to Cart</button>";
}

// ============================
// 203. Simple Currency Converter
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['amount'], $_POST['currency'])) {
    $amount = $_POST['amount'];
    $currency = $_POST['currency'];

    $conversion_rates = [
        'USD' => 1,
        'EUR' => 0.85,
        'GBP' => 0.75,
    ];

    if (isset($conversion_rates[$currency])) {
        $converted_amount = $amount * $conversion_rates[$currency];
        echo "<p>Converted Amount: $converted_amount $currency</p>";
    } else {
        echo "<p>Invalid currency selected.</p>";
    }
}

echo '<form action="" method="post">
        Amount: <input type="number" name="amount" required /><br>
        Currency: 
        <select name="currency" required>
            <option value="USD">USD</option>
            <option value="EUR">EUR</option>
            <option value="GBP">GBP</option>
        </select><br>
        <input type="submit" value="Convert" />
      </form>';

// ============================
// 204. Simple Contact Form with Validation
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['email'], $_POST['message'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        echo "<p>Invalid email address.</p>";
    } else {
        echo "<p>Thank you, $name! Your message has been received.</p>";
    }
}

echo '<form action="" method="post">
        Name: <input type="text" name="name" required /><br>
        Email: <input type="email" name="email" required /><br>
        Message: <textarea name="message" required></textarea><br>
        <input type="submit" value="Send Message" />
      </form>';

// ============================
// 205. Simple Todo List
// ============================
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['task'])) {
    $_SESSION['tasks'][] = $_POST['task'];
}

echo "<h3>Your Tasks:</h3>";
if (isset($_SESSION['tasks'])) {
    foreach ($_SESSION['tasks'] as $task) {
        echo "<p>- $task</p>";
    }
}

echo '<form action="" method="post">
        Task: <input type="text" name="task" required /><br>
        <input type="submit" value="Add Task" />
      </form>';

// ============================
// 206. Simple Image Gallery
// ============================
$images = ['image1.jpg', 'image2.jpg', 'image3.jpg'];

echo "<h3>Image Gallery</h3>";

foreach ($images as $image) {
    echo "<img src='$image' alt='Image' style='width:200px; height:200px;' />";
}

// ============================
// 207. Basic News Portal
// ============================
$news = [
    ['title' => 'Breaking News', 'content' => 'A big event has just happened in the world. Stay tuned for more details.'],
    ['title' => 'Tech News', 'content' => 'New technologies are changing the world. Get the latest updates here.'],
];

echo "<h3>News Portal</h3>";

foreach ($news as $article) {
    echo "<h4>" . $article['title'] . "</h4>";
    echo "<p>" . $article['content'] . "</p>";
}

// ============================
// 208. Simple Online Poll
// ============================
$poll_options = ['Option 1', 'Option 2', 'Option 3'];
$poll_votes = [0, 0, 0];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote'])) {
    $vote = $_POST['vote'];
    $poll_votes[$vote]++;
    echo "<p>Thank you for voting!</p>";
}

echo "<h3>Vote for your favorite option:</h3>";
foreach ($poll_options as $index => $option) {
    echo "<p>$option - Votes: " . $poll_votes[$index] . "</p>";
}

echo '<form action="" method="post">
        <label>Select your vote:</label><br>
        <input type="radio" name="vote" value="0" required /> Option 1<br>
        <input type="radio" name="vote" value="1" required /> Option 2<br>
        <input type="radio" name="vote" value="2" required /> Option 3<br>
        <input type="submit" value="Vote" />
      </form>';

// ============================
// 209. Simple Feedback Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['feedback'])) {
    $feedback = $_POST['feedback'];
    echo "<p>Thank you for your feedback: $feedback</p>";
}

echo '<form action="" method="post">
        Your Feedback: <textarea name="feedback" required></textarea><br>
        <input type="submit" value="Submit Feedback" />
      </form>';

// ============================
// 210. Simple File Upload System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $file = $_FILES['file'];
    $upload_dir = 'uploads/';
    $upload_file = $upload_dir . basename($file['name']);

    if (move_uploaded_file($file['tmp_name'], $upload_file)) {
        echo "<p>File uploaded successfully!</p>";
    } else {
        echo "<p>File upload failed.</p>";
    }
}

echo '<form action="" method="post" enctype="multipart/form-data">
        Select file to upload: <input type="file" name="file" required /><br>
        <input type="submit" value="Upload" />
      </form>';
?>
<?php
// ============================
// 211. Simple Login System with Sessions
// ============================
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username'], $_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    // Hardcoded username and password for simplicity
    if ($username === 'admin' && $password === 'password123') {
        $_SESSION['logged_in'] = true;
        echo "<p>Welcome, $username!</p>";
    } else {
        echo "<p>Invalid credentials. Please try again.</p>";
    }
}

if (!isset($_SESSION['logged_in'])) {
    echo '<form action="" method="post">
            Username: <input type="text" name="username" required /><br>
            Password: <input type="password" name="password" required /><br>
            <input type="submit" value="Login" />
          </form>';
} else {
    echo "<p>You are already logged in.</p>";
}

// ============================
// 212. Simple Registration Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['email'], $_POST['password'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $password = $_POST['password'];

    // Normally, save to database, here we just show a message
    echo "<p>Registration successful. Welcome, $name!</p>";
}

echo '<form action="" method="post">
        Name: <input type="text" name="name" required /><br>
        Email: <input type="email" name="email" required /><br>
        Password: <input type="password" name="password" required /><br>
        <input type="submit" value="Register" />
      </form>';

// ============================
// 213. Simple Newsletter Subscription
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['email'])) {
    $email = $_POST['email'];
    echo "<p>Thank you for subscribing with email: $email</p>";
}

echo '<form action="" method="post">
        Subscribe to our newsletter: <input type="email" name="email" required /><br>
        <input type="submit" value="Subscribe" />
      </form>';

// ============================
// 214. Contact Form with Email
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['email'], $_POST['message'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    $to = 'admin@example.com';
    $subject = 'New Contact Form Submission';
    $body = "Name: $name\nEmail: $email\nMessage: $message";
    $headers = 'From: ' . $email;

    if (mail($to, $subject, $body, $headers)) {
        echo "<p>Thank you, $name! Your message has been sent.</p>";
    } else {
        echo "<p>Failed to send the message. Please try again.</p>";
    }
}

echo '<form action="" method="post">
        Name: <input type="text" name="name" required /><br>
        Email: <input type="email" name="email" required /><br>
        Message: <textarea name="message" required></textarea><br>
        <input type="submit" value="Send Message" />
      </form>';

// ============================
// 215. Simple Voting System with Results
// ============================
$votes = [
    'Option 1' => 0,
    'Option 2' => 0,
    'Option 3' => 0,
];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote'])) {
    $vote = $_POST['vote'];
    $votes[$vote]++;
}

echo "<h3>Vote for your favorite option:</h3>";
foreach ($votes as $option => $count) {
    echo "<p>$option - Votes: $count</p>";
}

echo '<form action="" method="post">
        <label>Select your vote:</label><br>
        <input type="radio" name="vote" value="Option 1" required /> Option 1<br>
        <input type="radio" name="vote" value="Option 2" required /> Option 2<br>
        <input type="radio" name="vote" value="Option 3" required /> Option 3<br>
        <input type="submit" value="Vote" />
      </form>';

// ============================
// 216. Simple File Download System
// ============================
$file = 'sample.pdf';

if (isset($_GET['download'])) {
    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename="sample.pdf"');
    readfile($file);
    exit;
}

echo '<a href="?download=true">Download PDF File</a>';

// ============================
// 217. Simple Image Upload and Display
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['image'])) {
    $image = $_FILES['image'];
    $upload_dir = 'uploads/';
    $upload_file = $upload_dir . basename($image['name']);

    if (move_uploaded_file($image['tmp_name'], $upload_file)) {
        echo "<p>Image uploaded successfully!</p>";
        echo "<img src='$upload_file' alt='Uploaded Image' style='width:200px; height:200px;' />";
    } else {
        echo "<p>Failed to upload image.</p>";
    }
}

echo '<form action="" method="post" enctype="multipart/form-data">
        Select an image to upload: <input type="file" name="image" required /><br>
        <input type="submit" value="Upload Image" />
      </form>';

// ============================
// 218. Simple User Profile Page
// ============================
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username'], $_POST['email'])) {
    $_SESSION['username'] = $_POST['username'];
    $_SESSION['email'] = $_POST['email'];
}

if (isset($_SESSION['username'])) {
    echo "<h3>User Profile</h3>";
    echo "<p>Username: " . $_SESSION['username'] . "</p>";
    echo "<p>Email: " . $_SESSION['email'] . "</p>";
    echo '<a href="logout.php">Logout</a>';
} else {
    echo '<form action="" method="post">
            Username: <input type="text" name="username" required /><br>
            Email: <input type="email" name="email" required /><br>
            <input type="submit" value="Save Profile" />
          </form>';
}

// ============================
// 219. Simple To-Do List with Delete Option
// ============================
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['task'])) {
    $_SESSION['tasks'][] = $_POST['task'];
}

if (isset($_GET['delete'])) {
    $task_index = $_GET['delete'];
    unset($_SESSION['tasks'][$task_index]);
}

echo "<h3>To-Do List</h3>";

if (isset($_SESSION['tasks'])) {
    foreach ($_SESSION['tasks'] as $index => $task) {
        echo "<p>$task <a href='?delete=$index'>Delete</a></p>";
    }
}

echo '<form action="" method="post">
        Task: <input type="text" name="task" required /><br>
        <input type="submit" value="Add Task" />
      </form>';
?>
<?php
// ============================
// 220. Simple Calculator
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['num1'], $_POST['num2'], $_POST['operation'])) {
    $num1 = $_POST['num1'];
    $num2 = $_POST['num2'];
    $operation = $_POST['operation'];

    switch ($operation) {
        case 'add':
            $result = $num1 + $num2;
            break;
        case 'subtract':
            $result = $num1 - $num2;
            break;
        case 'multiply':
            $result = $num1 * $num2;
            break;
        case 'divide':
            if ($num2 != 0) {
                $result = $num1 / $num2;
            } else {
                $result = "Cannot divide by zero.";
            }
            break;
        default:
            $result = "Invalid operation.";
    }

    echo "<p>Result: $result</p>";
}

echo '<form action="" method="post">
        Number 1: <input type="number" name="num1" required /><br>
        Number 2: <input type="number" name="num2" required /><br>
        Operation: 
        <select name="operation">
            <option value="add">Add</option>
            <option value="subtract">Subtract</option>
            <option value="multiply">Multiply</option>
            <option value="divide">Divide</option>
        </select><br>
        <input type="submit" value="Calculate" />
      </form>';

// ============================
// 221. Currency Converter
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['amount'], $_POST['currency'])) {
    $amount = $_POST['amount'];
    $currency = $_POST['currency'];

    // Simple conversion rates
    $rates = [
        'USD' => 1,
        'EUR' => 0.85,
        'GBP' => 0.75,
        'INR' => 75
    ];

    if (isset($rates[$currency])) {
        $converted = $amount * $rates[$currency];
        echo "<p>$amount USD = $converted $currency</p>";
    } else {
        echo "<p>Invalid currency.</p>";
    }
}

echo '<form action="" method="post">
        Amount (in USD): <input type="number" name="amount" required /><br>
        Currency: 
        <select name="currency">
            <option value="EUR">EUR</option>
            <option value="GBP">GBP</option>
            <option value="INR">INR</option>
        </select><br>
        <input type="submit" value="Convert" />
      </form>';

// ============================
// 222. Simple Quiz App
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['answer'])) {
    $correct_answer = 'C';
    $user_answer = $_POST['answer'];
    
    if ($user_answer == $correct_answer) {
        echo "<p>Correct! You answered $user_answer.</p>";
    } else {
        echo "<p>Incorrect. The correct answer was $correct_answer.</p>";
    }
}

echo '<h3>What is the capital of France?</h3>';
echo '<form action="" method="post">
        A) Berlin <br>
        B) Madrid <br>
        C) Paris <br>
        <input type="radio" name="answer" value="A"> A <br>
        <input type="radio" name="answer" value="B"> B <br>
        <input type="radio" name="answer" value="C"> C <br><br>
        <input type="submit" value="Submit" />
      </form>';

// ============================
// 223. Simple Blog System
// ============================
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['title'], $_POST['content'])) {
    $_SESSION['posts'][] = [
        'title' => $_POST['title'],
        'content' => $_POST['content'],
    ];
}

echo "<h3>Blog Posts</h3>";

if (isset($_SESSION['posts'])) {
    foreach ($_SESSION['posts'] as $post) {
        echo "<h4>{$post['title']}</h4>";
        echo "<p>{$post['content']}</p>";
    }
}

echo '<form action="" method="post">
        Title: <input type="text" name="title" required /><br>
        Content: <textarea name="content" required></textarea><br>
        <input type="submit" value="Publish Post" />
      </form>';

// ============================
// 224. Basic Email Validation
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['email'])) {
    $email = $_POST['email'];

    if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
        echo "<p>$email is a valid email address.</p>";
    } else {
        echo "<p>$email is not a valid email address.</p>";
    }
}

echo '<form action="" method="post">
        Enter email: <input type="email" name="email" required /><br>
        <input type="submit" value="Validate Email" />
      </form>';

// ============================
// 225. Dynamic Drop-down List
// ============================
$categories = ['Technology', 'Health', 'Sports', 'Entertainment'];

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['category'])) {
    echo "<p>You selected: " . $_POST['category'] . "</p>";
}

echo '<form action="" method="post">
        Category: 
        <select name="category">
            <option value="">Select</option>';
foreach ($categories as $category) {
    echo "<option value='$category'>$category</option>";
}
echo '</select><br>
        <input type="submit" value="Submit" />
      </form>';

// ============================
// 226. Simple Guestbook System
// ============================
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['message'])) {
    $_SESSION['guestbook'][] = [
        'name' => $_POST['name'],
        'message' => $_POST['message'],
    ];
}

echo "<h3>Guestbook</h3>";

if (isset($_SESSION['guestbook'])) {
    foreach ($_SESSION['guestbook'] as $entry) {
        echo "<p><strong>{$entry['name']}</strong>: {$entry['message']}</p>";
    }
}

echo '<form action="" method="post">
        Name: <input type="text" name="name" required /><br>
        Message: <textarea name="message" required></textarea><br>
        <input type="submit" value="Sign Guestbook" />
      </form>';

// ============================
// 227. Simple Polling System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote'])) {
    $vote = $_POST['vote'];
    echo "<p>Thank you for voting for: $vote</p>";
}

echo '<h3>Which is your favorite programming language?</h3>';
echo '<form action="" method="post">
        <input type="radio" name="vote" value="PHP"> PHP<br>
        <input type="radio" name="vote" value="Python"> Python<br>
        <input type="radio" name="vote" value="JavaScript"> JavaScript<br>
        <input type="submit" value="Vote" />
      </form>';

// ============================
// 228. Random Number Generator
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['min'], $_POST['max'])) {
    $min = $_POST['min'];
    $max = $_POST['max'];

    $random_number = rand($min, $max);
    echo "<p>Generated Random Number: $random_number</p>";
}

echo '<form action="" method="post">
        Min: <input type="number" name="min" required /><br>
        Max: <input type="number" name="max" required /><br>
        <input type="submit" value="Generate" />
      </form>';
?>
<?php
// ============================
// 229. To-Do List Application
// ============================
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['task'])) {
    $_SESSION['tasks'][] = $_POST['task'];
}

echo "<h3>To-Do List</h3>";

if (isset($_SESSION['tasks'])) {
    foreach ($_SESSION['tasks'] as $task) {
        echo "<p>$task</p>";
    }
}

echo '<form action="" method="post">
        Task: <input type="text" name="task" required /><br>
        <input type="submit" value="Add Task" />
      </form>';

// ============================
// 230. Basic File Upload
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
    $file_name = $_FILES['file']['name'];
    $tmp_name = $_FILES['file']['tmp_name'];
    $upload_dir = 'uploads/';
    move_uploaded_file($tmp_name, $upload_dir . $file_name);
    echo "<p>File '$file_name' uploaded successfully!</p>";
}

echo '<form action="" method="post" enctype="multipart/form-data">
        Choose file: <input type="file" name="file" required /><br>
        <input type="submit" value="Upload" />
      </form>';

// ============================
// 231. Simple User Registration
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username'], $_POST['password'])) {
    $username = $_POST['username'];
    $password = password_hash($_POST['password'], PASSWORD_DEFAULT);
    
    // Store user credentials (In real applications, store in database)
    $_SESSION['user'] = ['username' => $username, 'password' => $password];

    echo "<p>User '$username' registered successfully!</p>";
}

echo '<form action="" method="post">
        Username: <input type="text" name="username" required /><br>
        Password: <input type="password" name="password" required /><br>
        <input type="submit" value="Register" />
      </form>';

// ============================
// 232. Simple Login System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login_username'], $_POST['login_password'])) {
    $login_username = $_POST['login_username'];
    $login_password = $_POST['login_password'];

    // In real applications, check against database
    if (isset($_SESSION['user']) && $login_username == $_SESSION['user']['username'] && password_verify($login_password, $_SESSION['user']['password'])) {
        echo "<p>Welcome, $login_username!</p>";
    } else {
        echo "<p>Invalid username or password.</p>";
    }
}

echo '<form action="" method="post">
        Username: <input type="text" name="login_username" required /><br>
        Password: <input type="password" name="login_password" required /><br>
        <input type="submit" value="Login" />
      </form>';

// ============================
// 233. Contact Form with Email
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['email'], $_POST['message'])) {
    $to = "admin@example.com";  // Change to your email address
    $subject = "Contact Form Submission";
    $message = "Name: {$_POST['name']}\nEmail: {$_POST['email']}\nMessage: {$_POST['message']}";
    $headers = "From: {$_POST['email']}";

    mail($to, $subject, $message, $headers);
    echo "<p>Message sent successfully!</p>";
}

echo '<form action="" method="post">
        Name: <input type="text" name="name" required /><br>
        Email: <input type="email" name="email" required /><br>
        Message: <textarea name="message" required></textarea><br>
        <input type="submit" value="Send Message" />
      </form>';

// ============================
// 234. File Download System
// ============================
$file = 'example.txt'; // Specify file to download
if ($_SERVER['REQUEST_METHOD'] == 'POST' && file_exists($file)) {
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="' . basename($file) . '"');
    header('Content-Length: ' . filesize($file));
    readfile($file);
    exit;
}

echo '<form action="" method="post">
        <input type="submit" value="Download File" />
      </form>';

// ============================
// 235. Image Gallery
// ============================
$images = ['image1.jpg', 'image2.jpg', 'image3.jpg']; // Array of images (change paths)
echo "<h3>Image Gallery</h3>";
foreach ($images as $image) {
    echo "<img src='$image' alt='Image' style='width:100px; height:100px; margin:10px;'>";
}

// ============================
// 236. Simple Chat Application (Without DB)
# Create a simple PHP-based chat using session or file
// ============================
session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['message'])) {
    $_SESSION['messages'][] = $_POST['message'];
}

echo "<h3>Chat Room</h3>";

if (isset($_SESSION['messages'])) {
    foreach ($_SESSION['messages'] as $message) {
        echo "<p>$message</p>";
    }
}

echo '<form action="" method="post">
        Message: <input type="text" name="message" required /><br>
        <input type="submit" value="Send" />
      </form>';

// ============================
// 237. Feedback Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['feedback'])) {
    $feedback = $_POST['feedback'];
    echo "<p>Thank you for your feedback!</p>";
}

echo '<form action="" method="post">
        Your Feedback: <textarea name="feedback" required></textarea><br>
        <input type="submit" value="Submit Feedback" />
      </form>';

// ============================
// 238. Basic Polling System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['poll'])) {
    echo "<p>You voted for: " . $_POST['poll'] . "</p>";
}

echo '<form action="" method="post">
        Vote for your favorite fruit:<br>
        <input type="radio" name="poll" value="Apple"> Apple<br>
        <input type="radio" name="poll" value="Banana"> Banana<br>
        <input type="radio" name="poll" value="Cherry"> Cherry<br>
        <input type="submit" value="Submit Vote" />
      </form>';

// ============================
// 239. Simple File Manager
// ============================
$dir = 'uploads/'; // Directory to manage files
if (!is_dir($dir)) {
    mkdir($dir);
}

$files = scandir($dir);
echo "<h3>File Manager</h3>";
foreach ($files as $file) {
    if ($file != '.' && $file != '..') {
        echo "<p><a href='$dir/$file'>$file</a></p>";
    }
}

echo '<form action="" method="post" enctype="multipart/form-data">
        Choose file to upload: <input type="file" name="file" required /><br>
        <input type="submit" value="Upload File" />
      </form>';

// ============================
// 240. Contact Form with Captcha
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['captcha'])) {
    if ($_POST['captcha'] == $_SESSION['captcha_answer']) {
        echo "<p>Captcha verified successfully!</p>";
    } else {
        echo "<p>Invalid Captcha.</p>";
    }
}

$captcha = rand(1000, 9999);
$_SESSION['captcha_answer'] = $captcha;

echo "<img src='https://via.placeholder.com/150?text=$captcha' alt='Captcha' /><br>";
echo '<form action="" method="post">
        Enter Captcha: <input type="text" name="captcha" required /><br>
        <input type="submit" value="Verify Captcha" />
      </form>';
?>
<?php
// ============================
// 241. Simple Newsletter Subscription
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['email'])) {
    $email = $_POST['email'];
    echo "<p>Thank you for subscribing with the email: $email!</p>";
}

echo '<form action="" method="post">
        Subscribe to our newsletter: <input type="email" name="email" required /><br>
        <input type="submit" value="Subscribe" />
      </form>';

// ============================
// 242. User Profile with Image Upload
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['profile_image'])) {
    $file_name = $_FILES['profile_image']['name'];
    $tmp_name = $_FILES['profile_image']['tmp_name'];
    $upload_dir = 'profiles/';
    move_uploaded_file($tmp_name, $upload_dir . $file_name);
    echo "<p>Profile picture uploaded successfully!</p>";
}

echo '<form action="" method="post" enctype="multipart/form-data">
        Choose Profile Image: <input type="file" name="profile_image" required /><br>
        <input type="submit" value="Upload" />
      </form>';

// ============================
// 243. Simple Event Booking System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['event_name'], $_POST['event_date'])) {
    $event_name = $_POST['event_name'];
    $event_date = $_POST['event_date'];
    echo "<p>Event '$event_name' booked for $event_date!</p>";
}

echo '<form action="" method="post">
        Event Name: <input type="text" name="event_name" required /><br>
        Event Date: <input type="date" name="event_date" required /><br>
        <input type="submit" value="Book Event" />
      </form>';

// ============================
// 244. File Search System
// ============================
$dir = 'uploads/';
$files = scandir($dir);
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['search'])) {
    $search = $_POST['search'];
    $results = array_filter($files, fn($file) => strpos($file, $search) !== false);
    
    echo "<h3>Search Results</h3>";
    foreach ($results as $file) {
        echo "<p><a href='$dir/$file'>$file</a></p>";
    }
} else {
    echo "<h3>All Files</h3>";
    foreach ($files as $file) {
        echo "<p><a href='$dir/$file'>$file</a></p>";
    }
}

echo '<form action="" method="post">
        Search for file: <input type="text" name="search" required /><br>
        <input type="submit" value="Search" />
      </form>';

// ============================
// 245. Simple Blog Post System
// ============================
$posts = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['title'], $_POST['content'])) {
    $title = $_POST['title'];
    $content = $_POST['content'];
    $posts[] = ['title' => $title, 'content' => $content];
}

echo "<h3>Blog Posts</h3>";
foreach ($posts as $post) {
    echo "<h4>{$post['title']}</h4><p>{$post['content']}</p>";
}

echo '<form action="" method="post">
        Title: <input type="text" name="title" required /><br>
        Content: <textarea name="content" required></textarea><br>
        <input type="submit" value="Post Blog" />
      </form>';

// ============================
// 246. Basic Address Book
// ============================
$contacts = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['email'], $_POST['phone'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $contacts[] = ['name' => $name, 'email' => $email, 'phone' => $phone];
}

echo "<h3>Contact List</h3>";
foreach ($contacts as $contact) {
    echo "<p>Name: {$contact['name']}<br>Email: {$contact['email']}<br>Phone: {$contact['phone']}</p>";
}

echo '<form action="" method="post">
        Name: <input type="text" name="name" required /><br>
        Email: <input type="email" name="email" required /><br>
        Phone: <input type="text" name="phone" required /><br>
        <input type="submit" value="Add Contact" />
      </form>';

// ============================
// 247. Simple Poll with Results
// ============================
$votes = ['Yes' => 0, 'No' => 0];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote'])) {
    $votes[$_POST['vote']]++;
}

echo "<h3>Poll: Do you like PHP?</h3>";
echo "<p>Yes: {$votes['Yes']}</p>";
echo "<p>No: {$votes['No']}</p>";

echo '<form action="" method="post">
        <input type="radio" name="vote" value="Yes" /> Yes<br>
        <input type="radio" name="vote" value="No" /> No<br>
        <input type="submit" value="Vote" />
      </form>';

// ============================
// 248. Guestbook System
// ============================
$messages = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['guest_message'])) {
    $guest_message = $_POST['guest_message'];
    $messages[] = $guest_message;
}

echo "<h3>Guestbook</h3>";
foreach ($messages as $message) {
    echo "<p>$message</p>";
}

echo '<form action="" method="post">
        Leave a message: <textarea name="guest_message" required></textarea><br>
        <input type="submit" value="Sign Guestbook" />
      </form>';

// ============================
// 249. Basic Ticket Booking System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['event'], $_POST['tickets'])) {
    $event = $_POST['event'];
    $tickets = $_POST['tickets'];
    echo "<p>You've booked $tickets tickets for the '$event' event!</p>";
}

echo '<form action="" method="post">
        Event: <input type="text" name="event" required /><br>
        Number of Tickets: <input type="number" name="tickets" required /><br>
        <input type="submit" value="Book Tickets" />
      </form>';

// ============================
// 250. Basic Email Validation System
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['email'])) {
    $email = $_POST['email'];
    if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
        echo "<p>Email '$email' is valid.</p>";
    } else {
        echo "<p>Email '$email' is invalid.</p>";
    }
}

echo '<form action="" method="post">
        Enter your email: <input type="email" name="email" required /><br>
        <input type="submit" value="Validate Email" />
      </form>';
?>
<?php
// ============================
// 251. Simple Task Management System
// ============================
$tasks = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['task_name'])) {
    $task_name = $_POST['task_name'];
    $tasks[] = $task_name;
}

echo "<h3>Task List</h3>";
foreach ($tasks as $task) {
    echo "<p>$task</p>";
}

echo '<form action="" method="post">
        Task: <input type="text" name="task_name" required /><br>
        <input type="submit" value="Add Task" />
      </form>';

// ============================
// 252. Simple To-Do List with Due Date
// ============================
$todo_items = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['todo_name'], $_POST['due_date'])) {
    $todo_name = $_POST['todo_name'];
    $due_date = $_POST['due_date'];
    $todo_items[] = ['task' => $todo_name, 'due' => $due_date];
}

echo "<h3>To-Do List</h3>";
foreach ($todo_items as $todo) {
    echo "<p>Task: {$todo['task']} | Due: {$todo['due']}</p>";
}

echo '<form action="" method="post">
        Task: <input type="text" name="todo_name" required /><br>
        Due Date: <input type="date" name="due_date" required /><br>
        <input type="submit" value="Add Task" />
      </form>';

// ============================
// 253. Contact Form with Email Notification
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name'], $_POST['email'], $_POST['message'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    $to = 'admin@example.com';
    $subject = "Contact Form Message from $name";
    $message_body = "Name: $name\nEmail: $email\nMessage: $message";
    mail($to, $subject, $message_body);
    echo "<p>Thank you for contacting us! We'll get back to you soon.</p>";
}

echo '<form action="" method="post">
        Name: <input type="text" name="name" required /><br>
        Email: <input type="email" name="email" required /><br>
        Message: <textarea name="message" required></textarea><br>
        <input type="submit" value="Submit" />
      </form>';

// ============================
// 254. Simple Currency Converter
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['amount'], $_POST['currency'])) {
    $amount = $_POST['amount'];
    $currency = $_POST['currency'];
    
    $conversion_rate = 0;
    if ($currency == 'USD') {
        $conversion_rate = 1.1; // Example: 1 USD = 1.1 EUR
    } else if ($currency == 'EUR') {
        $conversion_rate = 0.9; // Example: 1 EUR = 0.9 USD
    }

    $converted_amount = $amount * $conversion_rate;
    echo "<p>Converted Amount: $converted_amount</p>";
}

echo '<form action="" method="post">
        Amount: <input type="number" name="amount" required /><br>
        Convert to: 
        <select name="currency">
            <option value="USD">USD</option>
            <option value="EUR">EUR</option>
        </select><br>
        <input type="submit" value="Convert" />
      </form>';

// ============================
// 255. Real-Time Chat System (Using PHP and JavaScript)
// ============================
echo "<h3>Real-Time Chat</h3>";
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['message'])) {
    $message = $_POST['message'];
    // Save message to database or a text file
    echo "<p>You: $message</p>";
}

echo '<form action="" method="post">
        Message: <input type="text" name="message" required /><br>
        <input type="submit" value="Send" />
      </form>';

// ============================
// 256. Basic Online Polling System with Results
// ============================
$poll_results = ['Option 1' => 0, 'Option 2' => 0, 'Option 3' => 0];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['poll_option'])) {
    $poll_results[$_POST['poll_option']]++;
}

echo "<h3>Poll: What is your favorite color?</h3>";
foreach ($poll_results as $option => $votes) {
    echo "<p>$option: $votes votes</p>";
}

echo '<form action="" method="post">
        <input type="radio" name="poll_option" value="Option 1" /> Option 1<br>
        <input type="radio" name="poll_option" value="Option 2" /> Option 2<br>
        <input type="radio" name="poll_option" value="Option 3" /> Option 3<br>
        <input type="submit" value="Vote" />
      </form>';

// ============================
// 257. Basic Online Quiz with Score Calculation
// ============================
$questions = [
    'What is 2 + 2?' => ['answer' => '4', 'options' => ['3', '4', '5']],
    'What is the capital of France?' => ['answer' => 'Paris', 'options' => ['London', 'Berlin', 'Paris']],
];
$score = 0;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    foreach ($questions as $question => $data) {
        if (isset($_POST[$question]) && $_POST[$question] == $data['answer']) {
            $score++;
        }
    }
    echo "<p>Your score: $score / " . count($questions) . "</p>";
}

echo "<h3>Quiz</h3>";
foreach ($questions as $question => $data) {
    echo "<p>$question</p>";
    foreach ($data['options'] as $option) {
        echo "<input type='radio' name='$question' value='$option' /> $option<br>";
    }
}
echo '<input type="submit" value="Submit" />';

// ============================
// 258. File Upload and Display Images
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['image'])) {
    $file_name = $_FILES['image']['name'];
    $tmp_name = $_FILES['image']['tmp_name'];
    $upload_dir = 'uploads/';
    move_uploaded_file($tmp_name, $upload_dir . $file_name);
    echo "<p>Image uploaded successfully!</p>";
    echo "<img src='$upload_dir$file_name' />";
}

echo '<form action="" method="post" enctype="multipart/form-data">
        Choose Image: <input type="file" name="image" required /><br>
        <input type="submit" value="Upload Image" />
      </form>';

// ============================
// 259. URL Shortener
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['url'])) {
    $url = $_POST['url'];
    $shortened_url = substr(md5($url), 0, 6); // Simple shortening by hashing
    echo "<p>Shortened URL: <a href='$url'>$shortened_url</a></p>";
}

echo '<form action="" method="post">
        Enter URL: <input type="url" name="url" required /><br>
        <input type="submit" value="Shorten" />
      </form>';

// ============================
// 260. Simple Feedback Form
// ============================
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['feedback'])) {
    $feedback = $_POST['feedback'];
    echo "<p>Thank you for your feedback: $feedback</p>";
}

echo '<form action="" method="post">
        Your Feedback: <textarea name="feedback" required></textarea><br>
        <input type="submit" value="Submit Feedback" />
      </form>';
?>
Python

200 Mostly Used Program in Python With Code

# ============================
# 1. Hello World Program
# ============================
def hello_world():
    print("Hello, World!")

# ============================
# 2. Calculator
# ============================
def calculator():
    num1 = float(input("Enter first number: "))
    num2 = float(input("Enter second number: "))
    operation = input("Enter operation (+, -, *, /): ")
    if operation == "+":
        print(f"Result: {num1 + num2}")
    elif operation == "-":
        print(f"Result: {num1 - num2}")
    elif operation == "*":
        print(f"Result: {num1 * num2}")
    elif operation == "/":
        print(f"Result: {num1 / num2}")
    else:
        print("Invalid operation")

# ============================
# 3. Number Guessing Game
# ============================
import random
def number_guessing_game():
    number = random.randint(1, 100)
    guess = None
    while guess != number:
        guess = int(input("Guess the number between 1 and 100: "))
        if guess < number:
            print("Too low!")
        elif guess > number:
            print("Too high!")
        else:
            print("You guessed it!")

# ============================
# 4. Simple Alarm Clock
# ============================
import time
def alarm_clock():
    alarm_time = input("Enter alarm time (HH:MM:SS): ")
    print("Setting alarm...")
    while True:
        current_time = time.strftime("%H:%M:%S")
        if current_time == alarm_time:
            print("ALARM! Time's up!")
            break
        time.sleep(1)

# ============================
# 5. Countdown Timer
# ============================
def countdown_timer():
    seconds = int(input("Enter time in seconds: "))
    while seconds > 0:
        print(f"{seconds} seconds remaining")
        time.sleep(1)
        seconds -= 1
    print("Time's up!")

# ============================
# 6. Basic To-Do List
# ============================
def todo_list():
    tasks = []
    while True:
        task = input("Enter a task (or type 'quit' to exit): ")
        if task.lower() == "quit":
            break
        tasks.append(task)
    print("Your tasks:")
    for i, task in enumerate(tasks, 1):
        print(f"{i}. {task}")

# ============================
# 7. Temperature Converter
# ============================
def temperature_converter():
    temp = float(input("Enter temperature: "))
    scale = input("Enter scale (C for Celsius, F for Fahrenheit): ").lower()
    if scale == 'c':
        converted = (temp * 9/5) + 32
        print(f"{temp} Celsius is {converted} Fahrenheit")
    elif scale == 'f':
        converted = (temp - 32) * 5/9
        print(f"{temp} Fahrenheit is {converted} Celsius")
    else:
        print("Invalid scale")

# ============================
# 8. Basic Contact Book
# ============================
def contact_book():
    contacts = {}
    while True:
        name = input("Enter name (or type 'quit' to exit): ")
        if name.lower() == 'quit':
            break
        phone = input("Enter phone number: ")
        contacts[name] = phone
    print("Contacts:")
    for name, phone in contacts.items():
        print(f"{name}: {phone}")

# ============================
# 9. Number Converter (Binary, Decimal, Hex)
# ============================
def number_converter():
    num = int(input("Enter a number: "))
    print(f"Binary: {bin(num)}")
    print(f"Decimal: {num}")
    print(f"Hexadecimal: {hex(num)}")

# ============================
# 10. Mad Libs Game
# ============================
def mad_libs():
    adj = input("Enter an adjective: ")
    noun = input("Enter a noun: ")
    verb = input("Enter a verb: ")
    print(f"Once upon a time, a {adj} {noun} decided to {verb}.")

# ============================
# 11. Tic-Tac-Toe Game
# ============================
def tic_tac_toe():
    board = [" " for _ in range(9)]
    current_player = "X"
    def print_board():
        print(f"{board[0]} | {board[1]} | {board[2]}")
        print("--+---+--")
        print(f"{board[3]} | {board[4]} | {board[5]}")
        print("--+---+--")
        print(f"{board[6]} | {board[7]} | {board[8]}")
    while True:
        print_board()
        move = int(input(f"Player {current_player}, enter a position (1-9): ")) - 1
        if board[move] == " ":
            board[move] = current_player
            if current_player == "X":
                current_player = "O"
            else:
                current_player = "X"
        else:
            print("Invalid move. Try again.")
        if board.count(" ") == 0:
            print("It's a draw!")
            break

# ============================
# 12. Rock Paper Scissors Game
# ============================
def rock_paper_scissors():
    import random
    choices = ["rock", "paper", "scissors"]
    user_choice = input("Enter rock, paper, or scissors: ").lower()
    computer_choice = random.choice(choices)
    print(f"Computer chose: {computer_choice}")
    if user_choice == computer_choice:
        print("It's a draw!")
    elif (user_choice == "rock" and computer_choice == "scissors") or \
         (user_choice == "scissors" and computer_choice == "paper") or \
         (user_choice == "paper" and computer_choice == "rock"):
        print("You win!")
    else:
        print("You lose!")

# ============================
# 13. Simple Stopwatch
# ============================
import time
def stopwatch():
    input("Press Enter to start the stopwatch: ")
    start_time = time.time()
    input("Press Enter again to stop the stopwatch: ")
    end_time = time.time()
    elapsed_time = end_time - start_time
    print(f"Elapsed time: {elapsed_time:.2f} seconds")

# ============================
# 14. Palindrome Checker
# ============================
def palindrome_checker():
    word = input("Enter a word: ").lower()
    if word == word[::-1]:
        print("The word is a palindrome.")
    else:
        print("The word is not a palindrome.")

# ============================
# 15. Prime Number Checker
# ============================
def prime_number_checker():
    num = int(input("Enter a number: "))
    if num <= 1:
        print(f"{num} is not a prime number.")
    else:
        for i in range(2, int(num ** 0.5) + 1):
            if num % i == 0:
                print(f"{num} is not a prime number.")
                break
        else:
            print(f"{num} is a prime number.")

# ============================
# 16. Factorial Finder
# ============================
def factorial_finder():
    num = int(input("Enter a number: "))
    factorial = 1
    for i in range(1, num + 1):
        factorial *= i
    print(f"Factorial of {num} is {factorial}")

# ============================
# 17. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    terms = int(input("Enter number of terms: "))
    a, b = 0, 1
    for _ in range(terms):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 18. Hangman Game
# ============================
def hangman():
    word = "python"
    guessed = "_" * len(word)
    attempts = 6
    guessed_letters = []
    while attempts > 0 and "_" in guessed:
        print(f"Word: {guessed}")
        guess = input("Enter a letter: ").lower()
        if guess in guessed_letters:
            print(f"You already guessed '{guess}'")
        elif guess in word:
            guessed_letters.append(guess)
            guessed = "".join([letter if letter == guess or letter in guessed_letters else "_" for letter in word])
            print("Correct guess!")
        else:
            guessed_letters.append(guess)
            attempts -= 1
            print(f"Incorrect guess! You have {attempts} attempts left.")
    if "_" not in guessed:
        print(f"You won! The word is: {word}")
    else:
        print(f"You lost! The word was: {word}")

# ============================
# 19. Currency Converter
# ============================
def currency_converter():
    amount = float(input("Enter the amount: "))
    currency = input("Enter the currency to convert from (USD, EUR, INR): ").upper()
    if currency == "USD":
        converted = amount * 74.15  # Assuming 1 USD = 74.15 INR
        print(f"{amount} USD is {converted:.2f} INR")
    elif currency == "EUR":
        converted = amount * 89.65  # Assuming 1 EUR = 89.65 INR
        print(f"{amount} EUR is {converted:.2f} INR")
    elif currency == "INR":
        converted = amount / 74.15  # Converting INR to USD
        print(f"{amount} INR is {converted:.2f} USD")
    else:
        print("Invalid currency!")

# ============================
# 20. Email Slicer
# ============================
def email_slicer():
    email = input("Enter your email: ")
    username, domain = email.split('@')
    print(f"Username: {username}")
    print(f"Domain: {domain}")

# ============================
# 21. Age Calculator
# ============================
from datetime import datetime
def age_calculator():
    birthdate = input("Enter your birthdate (YYYY-MM-DD): ")
    birth_year = int(birthdate.split('-')[0])
    current_year = datetime.now().year
    age = current_year - birth_year
    print(f"Your age is {age} years.")

# ============================
# 22. Square of Numbers
# ============================
def square_of_numbers():
    num = int(input("Enter a number: "))
    print(f"The square of {num} is {num ** 2}")

# ============================
# 23. Multiplication Table
# ============================
def multiplication_table():
    num = int(input("Enter a number: "))
    for i in range(1, 11):
        print(f"{num} x {i} = {num * i}")

# ============================
# 24. Password Strength Checker
# ============================
import re
def password_strength_checker():
    password = input("Enter a password: ")
    if len(password) < 8:
        print("Password is too short!")
    elif not re.search(r"\d", password):
        print("Password should contain at least one number!")
    elif not re.search(r"[A-Za-z]", password):
        print("Password should contain at least one letter!")
    else:
        print("Password is strong.")

# ============================
# 25. Reverse String
# ============================
def reverse_string():
    string = input("Enter a string: ")
    print(f"Reversed string: {string[::-1]}")

# ============================
# 26. Even or Odd
# ============================
def even_or_odd():
    num = int(input("Enter a number: "))
    if num % 2 == 0:
        print(f"{num} is even")
    else:
        print(f"{num} is odd")

# ============================
# 27. Bubble Sort Algorithm
# ============================
def bubble_sort():
    arr = [int(x) for x in input("Enter numbers separated by space: ").split()]
    for i in range(len(arr)):
        for j in range(0, len(arr)-i-1):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    print(f"Sorted array: {arr}")

# ============================
# 28. Caesar Cipher
# ============================
def caesar_cipher():
    text = input("Enter the text to encrypt: ")
    shift = int(input("Enter the shift value: "))
    encrypted_text = ''.join([chr((ord(char) + shift - 97) % 26 + 97) if char.islower() else chr((ord(char) + shift - 65) % 26 + 65) if char.isupper() else char for char in text])
    print(f"Encrypted text: {encrypted_text}")

# ============================
# 29. Web Scraping (Using BeautifulSoup)
# ============================
import requests
from bs4 import BeautifulSoup
def web_scraping():
    url = input("Enter the URL to scrape: ")
    page = requests.get(url)
    soup = BeautifulSoup(page.content, 'html.parser')
    title = soup.title.string
    print(f"Page title: {title}")

# ============================
# 30. BMI Calculator
# ============================
def bmi_calculator():
    weight = float(input("Enter your weight in kg: "))
    height = float(input("Enter your height in meters: "))
    bmi = weight / (height ** 2)
    print(f"Your BMI is {bmi:.2f}")
    if bmi < 18.5:
        print("Underweight")
    elif 18.5 <= bmi < 24.9:
        print("Normal weight")
    elif 25 <= bmi < 29.9:
        print("Overweight")
    else:
        print("Obese")

# ============================
# 31. Simple Bank Account System
# ============================
class BankAccount:
    def __init__(self, name, balance=0):
        self.name = name
        self.balance = balance
    
    def deposit(self, amount):
        self.balance += amount
        print(f"Deposited {amount}. New balance: {self.balance}")

    def withdraw(self, amount):
        if amount > self.balance:
            print("Insufficient balance")
        else:
            self.balance -= amount
            print(f"Withdrew {amount}. New balance: {self.balance}")

    def check_balance(self):
        print(f"Current balance: {self.balance}")

def bank_system():
    name = input("Enter your name: ")
    account = BankAccount(name)
    while True:
        print("\n1. Deposit\n2. Withdraw\n3. Check Balance\n4. Exit")
        choice = int(input("Choose an option: "))
        if choice == 1:
            amount = float(input("Enter amount to deposit: "))
            account.deposit(amount)
        elif choice == 2:
            amount = float(input("Enter amount to withdraw: "))
            account.withdraw(amount)
        elif choice == 3:
            account.check_balance()
        elif choice == 4:
            break
        else:
            print("Invalid choice")

# ============================
# 32. Email Validator
# ============================
import re
def email_validator():
    email = input("Enter an email: ")
    if re.match(r"[^@]+@[^@]+\.[^@]+", email):
        print("Valid email address")
    else:
        print("Invalid email address")

# ============================
# 33. Countdown Clock
# ============================
import time
def countdown_clock():
    time_in_seconds = int(input("Enter countdown time in seconds: "))
    while time_in_seconds > 0:
        print(f"Time remaining: {time_in_seconds} seconds")
        time.sleep(1)
        time_in_seconds -= 1
    print("Time's up!")

# ============================
# 34. Fibonacci Number at Position
# ============================
def fibonacci_number():
    n = int(input("Enter the position (n): "))
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
    print(f"The {n}th Fibonacci number is {a}")

# ============================
# 35. Digital Clock
# ============================
import tkinter as tk
from time import strftime
def digital_clock():
    root = tk.Tk()
    root.title("Digital Clock")

    def time():
        string = strftime('%H:%M:%S %p')
        label.config(text=string)
        label.after(1000, time)

    label = tk.Label(root, font=('calibri', 50, 'bold'), background='black', foreground='yellow')
    label.pack(anchor='center')
    time()
    root.mainloop()

# ============================
# 36. Simple Number Counter
# ============================
def number_counter():
    start = int(input("Enter start number: "))
    end = int(input("Enter end number: "))
    for num in range(start, end + 1):
        print(num)

# ============================
# 37. String Length Calculator
# ============================
def string_length():
    string = input("Enter a string: ")
    print(f"The length of the string is {len(string)}")

# ============================
# 38. List Reverser
# ============================
def list_reverser():
    lst = [int(x) for x in input("Enter numbers separated by space: ").split()]
    print(f"Reversed list: {lst[::-1]}")

# ============================
# 39. Simple Interest Calculator
# ============================
def simple_interest_calculator():
    p = float(input("Enter principal amount: "))
    r = float(input("Enter rate of interest: "))
    t = float(input("Enter time in years: "))
    si = (p * r * t) / 100
    print(f"Simple Interest: {si}")

# ============================
# 40. Leap Year Checker
# ============================
def leap_year_checker():
    year = int(input("Enter a year: "))
    if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
        print(f"{year} is a leap year.")
    else:
        print(f"{year} is not a leap year.")
# ============================
# 41. Simple Voting System
# ============================
def voting_system():
    votes = {'Candidate A': 0, 'Candidate B': 0, 'Candidate C': 0}
    while True:
        print("\n1. Vote for Candidate A\n2. Vote for Candidate B\n3. Vote for Candidate C\n4. Exit")
        choice = int(input("Choose your option: "))
        if choice == 1:
            votes['Candidate A'] += 1
            print("You voted for Candidate A.")
        elif choice == 2:
            votes['Candidate B'] += 1
            print("You voted for Candidate B.")
        elif choice == 3:
            votes['Candidate C'] += 1
            print("You voted for Candidate C.")
        elif choice == 4:
            break
        else:
            print("Invalid choice.")
    
    print("\nVoting Results:")
    for candidate, vote_count in votes.items():
        print(f"{candidate}: {vote_count} votes")

# ============================
# 42. Prime Number Checker
# ============================
def prime_number_checker():
    num = int(input("Enter a number: "))
    if num > 1:
        for i in range(2, num):
            if num % i == 0:
                print(f"{num} is not a prime number.")
                break
        else:
            print(f"{num} is a prime number.")
    else:
        print(f"{num} is not a prime number.")

# ============================
# 43. Countdown Timer
# ============================
import time
def countdown_timer():
    count = int(input("Enter countdown time in seconds: "))
    while count >= 0:
        mins, secs = divmod(count, 60)
        timeformat = '{:02d}:{:02d}'.format(mins, secs)
        print(timeformat, end='\r')
        time.sleep(1)
        count -= 1
    print("Time's up!")

# ============================
# 44. Random Password Generator
# ============================
import random
import string
def password_generator():
    length = int(input("Enter the desired password length: "))
    password = ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation, k=length))
    print(f"Generated Password: {password}")

# ============================
# 45. Distance Converter
# ============================
def distance_converter():
    distance = float(input("Enter the distance in kilometers: "))
    miles = distance * 0.621371
    yards = distance * 1094
    feet = distance * 3280.84
    print(f"{distance} kilometers is equal to {miles:.2f} miles, {yards:.2f} yards, or {feet:.2f} feet.")

# ============================
# 46. Simple Alarm Clock
# ============================
import datetime
import time
def alarm_clock():
    alarm_time = input("Enter the alarm time in HH:MM format: ")
    while True:
        current_time = datetime.datetime.now().strftime("%H:%M")
        if current_time == alarm_time:
            print("Time to wake up!")
            break
        time.sleep(10)

# ============================
# 47. Tic-Tac-Toe Game
# ============================
def print_board(board):
    for row in board:
        print(" | ".join(row))
        print("-" * 5)

def tic_tac_toe():
    board = [[" " for _ in range(3)] for _ in range(3)]
    current_player = "X"
    while True:
        print_board(board)
        row = int(input(f"Player {current_player}, enter row (0, 1, 2): "))
        col = int(input(f"Player {current_player}, enter column (0, 1, 2): "))
        if board[row][col] == " ":
            board[row][col] = current_player
            if any(all(cell == current_player for cell in row) for row in board) or \
                any(all(board[i][j] == current_player for i in range(3)) for j in range(3)) or \
                board[0][0] == current_player and board[1][1] == current_player and board[2][2] == current_player or \
                board[0][2] == current_player and board[1][1] == current_player and board[2][0] == current_player:
                print_board(board)
                print(f"Player {current_player} wins!")
                break
            current_player = "O" if current_player == "X" else "X"
        else:
            print("Cell already occupied, try again.")

# ============================
# 48. Age Calculator Using Birthdate
# ============================
from datetime import datetime
def age_calculator_from_birthdate():
    birth_date = input("Enter your birthdate (YYYY-MM-DD): ")
    birth_date = datetime.strptime(birth_date, "%Y-%m-%d")
    today = datetime.today()
    age = today.year - birth_date.year
    if today.month < birth_date.month or (today.month == birth_date.month and today.day < birth_date.day):
        age -= 1
    print(f"Your age is {age} years.")

# ============================
# 49. Character Frequency Counter
# ============================
def char_frequency_counter():
    string = input("Enter a string: ")
    frequency = {}
    for char in string:
        frequency[char] = frequency.get(char, 0) + 1
    print(f"Character frequencies: {frequency}")

# ============================
# 50. Simple Calculator with Functions
# ============================
def add(x, y):
    return x + y

def subtract(x, y):
    return x - y

def multiply(x, y):
    return x * y

def divide(x, y):
    if y == 0:
        return "Cannot divide by zero"
    return x / y

def calculator():
    while True:
        print("\n1. Add\n2. Subtract\n3. Multiply\n4. Divide\n5. Exit")
        choice = int(input("Choose an operation: "))
        if choice == 5:
            break
        num1 = float(input("Enter first number: "))
        num2 = float(input("Enter second number: "))
        if choice == 1:
            print(f"Result: {add(num1, num2)}")
        elif choice == 2:
            print(f"Result: {subtract(num1, num2)}")
        elif choice == 3:
            print(f"Result: {multiply(num1, num2)}")
        elif choice == 4:
            print(f"Result: {divide(num1, num2)}")
        else:
            print("Invalid choice")

# ============================
# 51. Armstrong Number Checker
# ============================
def armstrong_number_checker():
    num = int(input("Enter a number: "))
    order = len(str(num))
    total = sum(int(digit) ** order for digit in str(num))
    if num == total:
        print(f"{num} is an Armstrong number.")
    else:
        print(f"{num} is not an Armstrong number.")

# ============================
# 52. Palindrome Checker
# ============================
def palindrome_checker():
    string = input("Enter a string: ")
    if string == string[::-1]:
        print(f"{string} is a palindrome.")
    else:
        print(f"{string} is not a palindrome.")

# ============================
# 53. Random Joke Generator
# ============================
import pyjokes
def joke_generator():
    joke = pyjokes.get_joke()
    print(f"Here's a random joke: {joke}")

# ============================
# 54. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms: "))
    a, b = 0, 1
    print(f"The Fibonacci sequence is: ")
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 55. Number Guessing Game
# ============================
import random
def number_guessing_game():
    number = random.randint(1, 100)
    guess = None
    while guess != number:
        guess = int(input("Guess the number between 1 and 100: "))
        if guess < number:
            print("Too low!")
        elif guess > number:
            print("Too high!")
        else:
            print("Congratulations! You guessed the number.")

# ============================
# 56. Text File Word Counter
# ============================
def word_counter():
    filename = input("Enter the filename: ")
    try:
        with open(filename, 'r') as file:
            text = file.read()
            words = text.split()
            print(f"The file contains {len(words)} words.")
    except FileNotFoundError:
        print("File not found!")

# ============================
# 57. Odd or Even Number Checker
# ============================
def odd_even_checker():
    num = int(input("Enter a number: "))
    if num % 2 == 0:
        print(f"{num} is an even number.")
    else:
        print(f"{num} is an odd number.")

# ============================
# 58. Simple Calculator Using GUI (Tkinter)
# ============================
import tkinter as tk
def calculator_gui():
    def button_click(number):
        current = entry.get()
        entry.delete(0, tk.END)
        entry.insert(0, current + str(number))
    
    def button_clear():
        entry.delete(0, tk.END)

    def button_equal():
        try:
            result = eval(entry.get())
            entry.delete(0, tk.END)
            entry.insert(0, result)
        except Exception as e:
            entry.delete(0, tk.END)
            entry.insert(0, "Error")

    root = tk.Tk()
    root.title("Calculator")
    entry = tk.Entry(root, width=16, font=("Arial", 24), borderwidth=5, relief="solid")
    entry.grid(row=0, column=0, columnspan=4)

    buttons = [
        ("1", 1, 1), ("2", 1, 2), ("3", 1, 3), ("+", 1, 4),
        ("4", 2, 1), ("5", 2, 2), ("6", 2, 3), ("-", 2, 4),
        ("7", 3, 1), ("8", 3, 2), ("9", 3, 3), ("*", 3, 4),
        ("C", 4, 1), ("0", 4, 2), ("=", 4, 3), ("/", 4, 4),
    ]

    for (text, row, col) in buttons:
        button = tk.Button(root, text=text, width=10, height=3, font=("Arial", 18),
                           command=lambda text=text: button_click(text) if text not in ("C", "=") else (button_clear() if text == "C" else button_equal()))
        button.grid(row=row, column=col)

    root.mainloop()

# ============================
# 59. Weather App (Using API)
# ============================
import requests
def weather_app():
    api_key = "your_api_key_here"
    city = input("Enter city name: ")
    url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    response = requests.get(url).json()
    if response["cod"] == "404":
        print(f"City {city} not found!")
    else:
        main = response["main"]
        temperature = main["temp"]
        pressure = main["pressure"]
        humidity = main["humidity"]
        weather_desc = response["weather"][0]["description"]
        print(f"Temperature: {temperature}°C\nPressure: {pressure} hPa\nHumidity: {humidity}%\nWeather Description: {weather_desc}")

# ============================
# 60. Currency Converter
# ============================
import requests
def currency_converter():
    amount = float(input("Enter the amount: "))
    from_currency = input("Enter the base currency: ").upper()
    to_currency = input("Enter the target currency: ").upper()
    url = f"https://api.exchangerate-api.com/v4/latest/{from_currency}"
    response = requests.get(url).json()
    if "error" in response:
        print("Invalid currency code!")
    else:
        conversion_rate = response["rates"].get(to_currency)
        if conversion_rate:
            converted_amount = amount * conversion_rate
            print(f"{amount} {from_currency} = {converted_amount:.2f} {to_currency}")
        else:
            print("Conversion rate not found.")
       # ============================
# 61. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter your email address: ")
    # Regular expression for validating an email
    regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    
    if re.match(regex, email):
        print(f"{email} is a valid email address.")
    else:
        print(f"{email} is not a valid email address.")

# ============================
# 62. Unit Converter (Temperature)
# ============================
def temperature_converter():
    print("Choose the conversion:")
    print("1. Celsius to Fahrenheit")
    print("2. Fahrenheit to Celsius")
    choice = int(input("Enter choice (1 or 2): "))
    
    if choice == 1:
        celsius = float(input("Enter temperature in Celsius: "))
        fahrenheit = (celsius * 9/5) + 32
        print(f"{celsius}°C is equal to {fahrenheit}°F.")
    elif choice == 2:
        fahrenheit = float(input("Enter temperature in Fahrenheit: "))
        celsius = (fahrenheit - 32) * 5/9
        print(f"{fahrenheit}°F is equal to {celsius}°C.")
    else:
        print("Invalid choice.")

# ============================
# 63. Roman to Integer Converter
# ============================
def roman_to_integer():
    roman = input("Enter a Roman numeral: ").upper()
    roman_dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
    total = 0
    prev_value = 0
    
    for char in reversed(roman):
        value = roman_dict.get(char, 0)
        if value < prev_value:
            total -= value
        else:
            total += value
        prev_value = value
    
    print(f"The integer value of {roman} is {total}.")

# ============================
# 64. Simple Interest Calculator
# ============================
def simple_interest():
    principal = float(input("Enter the principal amount: "))
    rate = float(input("Enter the rate of interest: "))
    time = float(input("Enter the time period in years: "))
    
    interest = (principal * rate * time) / 100
    print(f"The simple interest is: {interest}")
    total_amount = principal + interest
    print(f"The total amount after interest is: {total_amount}")

# ============================
# 65. Countdown Timer (with Custom Message)
# ============================
import time

def countdown_timer_custom_message():
    count = int(input("Enter countdown time in seconds: "))
    message = input("Enter a custom message for the countdown: ")
    
    while count >= 0:
        mins, secs = divmod(count, 60)
        timeformat = '{:02d}:{:02d}'.format(mins, secs)
        print(timeformat, end='\r')
        time.sleep(1)
        count -= 1
    
    print(f"Time's up! {message}")

# ============================
# 66. String to Pig Latin Converter
# ============================
def pig_latin_converter():
    sentence = input("Enter a sentence: ").split()
    pig_latin_sentence = []
    
    for word in sentence:
        first_letter = word[0].lower()
        if first_letter in 'aeiou':
            pig_latin_word = word + 'way'
        else:
            pig_latin_word = word[1:] + first_letter + 'ay'
        pig_latin_sentence.append(pig_latin_word.lower())
    
    print(f"Pig Latin version: {' '.join(pig_latin_sentence)}")

# ============================
# 67. Multiplication Table Generator
# ============================
def multiplication_table():
    number = int(input("Enter a number to generate its multiplication table: "))
    for i in range(1, 11):
        print(f"{number} x {i} = {number * i}")

# ============================
# 68. Magic 8 Ball
# ============================
import random

def magic_8_ball():
    responses = [
        "Yes", "No", "Maybe", "Ask again later", "Definitely not", "Yes, but not right now", 
        "The future is unclear", "I don't know", "Certainly", "Not a chance"
    ]
    question = input("Ask a yes or no question: ")
    print(f"Magic 8 Ball says: {random.choice(responses)}")

# ============================
# 69. Vowel Counter
# ============================
def vowel_counter():
    string = input("Enter a string: ")
    vowels = "aeiouAEIOU"
    count = sum(1 for char in string if char in vowels)
    print(f"The number of vowels in the string is: {count}")

# ============================
# 70. Loan EMI Calculator
# ============================
def loan_emi_calculator():
    principal = float(input("Enter the loan amount: "))
    rate = float(input("Enter the rate of interest (annual): ")) / 100 / 12
    months = int(input("Enter the number of months to pay: "))
    
    emi = (principal * rate * (1 + rate) ** months) / ((1 + rate) ** months - 1)
    print(f"Your monthly EMI is: {emi:.2f}")

# ============================
# 71. Contact Book System
# ============================
def contact_book():
    contacts = {}
    
    def add_contact():
        name = input("Enter name: ")
        phone = input("Enter phone number: ")
        contacts[name] = phone
        print(f"Contact {name} added.")
    
    def view_contacts():
        if contacts:
            for name, phone in contacts.items():
                print(f"Name: {name}, Phone: {phone}")
        else:
            print("No contacts available.")
    
    while True:
        print("1. Add Contact")
        print("2. View Contacts")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_contact()
        elif choice == 2:
            view_contacts()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")

# ============================
# 72. Task Tracker
# ============================
def task_tracker():
    tasks = []
    
    def add_task():
        task = input("Enter task: ")
        tasks.append(task)
        print(f"Task '{task}' added.")
    
    def view_tasks():
        if tasks:
            print("Your tasks:")
            for task in tasks:
                print(f"- {task}")
        else:
            print("No tasks available.")
    
    while True:
        print("1. Add Task")
        print("2. View Tasks")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_task()
        elif choice == 2:
            view_tasks()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")

# ============================
# 73. Birthday Reminder
# ============================
def birthday_reminder():
    birthdays = {}
    
    def add_birthday():
        name = input("Enter the name: ")
        date = input("Enter the birthday (DD/MM/YYYY): ")
        birthdays[name] = date
        print(f"Birthday for {name} added.")
    
    def view_birthdays():
        if birthdays:
            for name, date in birthdays.items():
                print(f"{name}: {date}")
        else:
            print("No birthdays available.")
    
    while True:
        print("1. Add Birthday")
        print("2. View Birthdays")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_birthday()
        elif choice == 2:
            view_birthdays()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")

# ============================
# 74. Palindrome Checker
# ============================
def palindrome_checker():
    string = input("Enter a string: ").lower()
    if string == string[::-1]:
        print(f"{string} is a palindrome.")
    else:
        print(f"{string} is not a palindrome.")

# ============================
# 75. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number = random.randint(1, 100)
    attempts = 0
    
    while True:
        guess = int(input("Guess the number between 1 and 100: "))
        attempts += 1
        if guess < number:
            print("Too low. Try again.")
        elif guess > number:
            print("Too high. Try again.")
        else:
            print(f"Congratulations! You guessed the number in {attempts} attempts.")
            break

# ============================
# 76. Tip Calculator
# ============================
def tip_calculator():
    amount = float(input("Enter the total amount: "))
    tip_percentage = float(input("Enter the tip percentage: "))
    tip = (amount * tip_percentage) / 100
    total_amount = amount + tip
    print(f"The tip is: {tip:.2f}")
    print(f"The total amount after tip is: {total_amount:.2f}")

# ============================
# 77. Loan Amortization Calculator
# ============================
def loan_amortization():
    principal = float(input("Enter loan amount: "))
    rate = float(input("Enter annual interest rate (in %): ")) / 100 / 12
    months = int(input("Enter number of months: "))
    
    emi = (principal * rate * (1 + rate) ** months) / ((1 + rate) ** months - 1)
    
    print(f"Your EMI is: {emi:.2f}")
    
    print("Amortization Schedule:")
    for month in range(1, months + 1):
        principal_payment = emi - (principal * rate)
        interest_payment = principal * rate
        principal -= principal_payment
        print(f"Month {month}: Interest = {interest_payment:.2f}, Principal = {principal_payment:.2f}, Remaining Principal = {principal:.2f}")

# ============================
# 78. Countdown Timer (Interactive)
# ============================
import time

def interactive_countdown_timer():
    seconds = int(input("Enter the number of seconds: "))
    
    for i in range(seconds, 0, -1):
        print(i, end="\r")
        time.sleep(1)
    
    print("Time's up!")

# ============================
# 79. Password Strength Checker
# ============================
import re

def password_strength_checker():
    password = input("Enter your password: ")
    
    # Check if password meets the criteria
    if len(password) < 8:
        print("Password too short! It must be at least 8 characters.")
    elif not re.search("[a-z]", password):
        print("Password must contain at least one lowercase letter.")
    elif not re.search("[A-Z]", password):
        print("Password must contain at least one uppercase letter.")
    elif not re.search("[0-9]", password):
        print("Password must contain at least one number.")
    elif not re.search("[!@#$%^&*(),.?\":{}|<>]", password):
        print("Password must contain at least one special character.")
    else:
        print("Password is strong.")

# ============================
# 80. Basic To-Do List
# ============================
def todo_list():
    todos = []
    
    def add_todo():
        todo = input("Enter a to-do item: ")
        todos.append(todo)
        print(f"'{todo}' added to the to-do list.")
    
    def view_todos():
        if todos:
            print("Your To-Do List:")
            for idx, todo in enumerate(todos, start=1):
                print(f"{idx}. {todo}")
        else:
            print("No to-do items.")
    
    while True:
        print("1. Add To-Do")
        print("2. View To-Dos")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_todo()
        elif choice == 2:
            view_todos()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")
# ============================
# 81. Simple Calculator
# ============================
def simple_calculator():
    print("Welcome to the Simple Calculator!")
    while True:
        print("\nSelect operation:")
        print("1. Add")
        print("2. Subtract")
        print("3. Multiply")
        print("4. Divide")
        print("5. Exit")
        
        choice = input("Enter choice(1/2/3/4/5): ")
        
        if choice == '5':
            print("Exiting the calculator. Goodbye!")
            break
            
        num1 = float(input("Enter first number: "))
        num2 = float(input("Enter second number: "))
        
        if choice == '1':
            print(f"{num1} + {num2} = {num1 + num2}")
        elif choice == '2':
            print(f"{num1} - {num2} = {num1 - num2}")
        elif choice == '3':
            print(f"{num1} * {num2} = {num1 * num2}")
        elif choice == '4':
            if num2 != 0:
                print(f"{num1} / {num2} = {num1 / num2}")
            else:
                print("Cannot divide by zero!")
        else:
            print("Invalid input, please try again.")

# ============================
# 82. Currency Converter
# ============================
def currency_converter():
    print("Welcome to the Currency Converter!")
    conversion_rates = {
        "USD": 1,
        "EUR": 0.85,
        "INR": 75.00,
        "GBP": 0.74,
        "JPY": 110.30
    }
    
    base_currency = input("Enter the base currency (USD, EUR, INR, GBP, JPY): ").upper()
    if base_currency not in conversion_rates:
        print("Invalid currency.")
        return
    
    amount = float(input(f"Enter amount in {base_currency}: "))
    target_currency = input("Enter the target currency (USD, EUR, INR, GBP, JPY): ").upper()
    if target_currency not in conversion_rates:
        print("Invalid target currency.")
        return
    
    conversion_rate = conversion_rates[target_currency] / conversion_rates[base_currency]
    converted_amount = amount * conversion_rate
    print(f"{amount} {base_currency} = {converted_amount:.2f} {target_currency}")

# ============================
# 83. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birth_date = input("Enter your birthdate (DD/MM/YYYY): ")
    birth_date = datetime.strptime(birth_date, "%d/%m/%Y")
    today = datetime.today()
    
    age = today.year - birth_date.year
    if today.month < birth_date.month or (today.month == birth_date.month and today.day < birth_date.day):
        age -= 1
    
    print(f"Your age is: {age} years.")

# ============================
# 84. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter your email: ")
    if re.match(r"[^@]+@[^@]+\.[^@]+", email):
        print("Valid email address.")
    else:
        print("Invalid email address.")

# ============================
# 85. Dice Roller Simulation
# ============================
import random

def dice_roller():
    print("Welcome to the Dice Roller Simulator!")
    while True:
        roll = input("Roll the dice (y/n): ").lower()
        if roll == 'y':
            dice_roll = random.randint(1, 6)
            print(f"You rolled a {dice_roll}")
        elif roll == 'n':
            print("Exiting the Dice Roller. Goodbye!")
            break
        else:
            print("Invalid input. Please enter 'y' or 'n'.")

# ============================
# 86. Tic-Tac-Toe Game
# ============================
def tic_tac_toe():
    board = [" " for _ in range(9)]
    current_player = "X"
    
    def print_board():
        print(f"{board[0]} | {board[1]} | {board[2]}")
        print("--+---+--")
        print(f"{board[3]} | {board[4]} | {board[5]}")
        print("--+---+--")
        print(f"{board[6]} | {board[7]} | {board[8]}")
    
    def check_winner():
        for i in range(0, 9, 3):
            if board[i] == board[i+1] == board[i+2] != " ":
                return True
        for i in range(3):
            if board[i] == board[i+3] == board[i+6] != " ":
                return True
        if board[0] == board[4] == board[8] != " ":
            return True
        if board[2] == board[4] == board[6] != " ":
            return True
        return False
    
    while " " in board:
        print_board()
        move = int(input(f"Player {current_player}, enter your move (1-9): ")) - 1
        if board[move] == " ":
            board[move] = current_player
            if check_winner():
                print_board()
                print(f"Player {current_player} wins!")
                break
            current_player = "O" if current_player == "X" else "X"
        else:
            print("Invalid move, try again.")
    else:
        print("It's a draw!")
        print_board()

# ============================
# 87. Simple Stopwatch
# ============================
import time

def stopwatch():
    print("Welcome to the Stopwatch!")
    input("Press Enter to start...")
    start_time = time.time()
    
    while True:
        input("Press Enter to stop...")
        end_time = time.time()
        elapsed_time = round(end_time - start_time, 2)
        print(f"Elapsed time: {elapsed_time} seconds")
        break

# ============================
# 88. Weather Information Fetcher
# ============================
import requests

def weather_info():
    api_key = "YOUR_API_KEY"  # Replace with your OpenWeatherMap API key
    city = input("Enter city name: ")
    url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    
    response = requests.get(url)
    data = response.json()
    
    if data["cod"] == "404":
        print("City not found!")
    else:
        main = data["main"]
        temperature = main["temp"]
        humidity = main["humidity"]
        description = data["weather"][0]["description"]
        print(f"Temperature: {temperature}°C")
        print(f"Humidity: {humidity}%")
        print(f"Weather: {description}")

# ============================
# 89. Countdown Timer (Fixed Time)
# ============================
def countdown_timer_fixed():
    print("Enter time for countdown (in seconds): ")
    seconds = int(input())
    while seconds >= 0:
        minutes, sec = divmod(seconds, 60)
        print(f"{minutes:02}:{sec:02}", end="\r")
        time.sleep(1)
        seconds -= 1
    print("Time's up!")

# ============================
# 90. Contact Info Search
# ============================
def contact_info_search():
    contacts = {
        "John": "1234567890",
        "Alice": "0987654321",
        "Bob": "1122334455",
    }
    
    name = input("Enter contact name: ")
    if name in contacts:
        print(f"Contact information for {name}: {contacts[name]}")
    else:
        print("Contact not found.")

# ============================
# 91. To-Do List Application
# ============================
def todo_list():
    todos = []
    
    while True:
        print("\nTo-Do List:")
        print("1. Add Task")
        print("2. View Tasks")
        print("3. Remove Task")
        print("4. Exit")
        
        choice = input("Choose an option: ")
        
        if choice == '1':
            task = input("Enter the task: ")
            todos.append(task)
        elif choice == '2':
            if todos:
                print("\nYour Tasks:")
                for i, task in enumerate(todos, start=1):
                    print(f"{i}. {task}")
            else:
                print("No tasks available.")
        elif choice == '3':
            if todos:
                task_num = int(input(f"Enter task number to remove (1-{len(todos)}): "))
                if 1 <= task_num <= len(todos):
                    removed_task = todos.pop(task_num - 1)
                    print(f"Removed task: {removed_task}")
                else:
                    print("Invalid task number.")
            else:
                print("No tasks to remove.")
        elif choice == '4':
            print("Exiting To-Do List. Goodbye!")
            break
        else:
            print("Invalid option, try again.")

# ============================
# 92. Palindrome Checker
# ============================
def palindrome_checker():
    word = input("Enter a word: ").lower()
    if word == word[::-1]:
        print(f"{word} is a palindrome!")
    else:
        print(f"{word} is not a palindrome.")

# ============================
# 93. Fibonacci Sequence
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms in the Fibonacci sequence: "))
    a, b = 0, 1
    print(f"Fibonacci sequence with {n} terms:")
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 94. Number Guessing Game
# ============================
import random

def number_guessing_game():
    print("Welcome to the Number Guessing Game!")
    number = random.randint(1, 100)
    attempts = 0
    
    while True:
        guess = int(input("Guess a number between 1 and 100: "))
        attempts += 1
        
        if guess < number:
            print("Too low! Try again.")
        elif guess > number:
            print("Too high! Try again.")
        else:
            print(f"Correct! The number was {number}. You guessed it in {attempts} attempts.")
            break

# ============================
# 95. Prime Number Checker
# ============================
def prime_number_checker():
    num = int(input("Enter a number: "))
    if num < 2:
        print(f"{num} is not a prime number.")
        return
    
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            print(f"{num} is not a prime number.")
            return
    
    print(f"{num} is a prime number.")

# ============================
# 96. Simple Interest Calculator
# ============================
def simple_interest_calculator():
    principal = float(input("Enter the principal amount: "))
    rate = float(input("Enter the rate of interest: "))
    time = float(input("Enter the time period (in years): "))
    
    interest = (principal * rate * time) / 100
    total_amount = principal + interest
    
    print(f"Simple Interest: {interest}")
    print(f"Total Amount: {total_amount}")

# ============================
# 97. Number Counter
# ============================
def number_counter():
    count = int(input("Enter a number to count up to: "))
    
    for i in range(1, count + 1):
        print(i, end=" ")
    print()

# ============================
# 98. Temperature Converter
# ============================
def temperature_converter():
    print("1. Celsius to Fahrenheit")
    print("2. Fahrenheit to Celsius")
    
    choice = input("Choose conversion type (1 or 2): ")
    
    if choice == '1':
        celsius = float(input("Enter temperature in Celsius: "))
        fahrenheit = (celsius * 9/5) + 32
        print(f"{celsius}°C = {fahrenheit}°F")
    elif choice == '2':
        fahrenheit = float(input("Enter temperature in Fahrenheit: "))
        celsius = (fahrenheit - 32) * 5/9
        print(f"{fahrenheit}°F = {celsius}°C")
    else:
        print("Invalid choice.")

# ============================
# 99. Multiplication Table
# ============================
def multiplication_table():
    num = int(input("Enter a number to display its multiplication table: "))
    print(f"Multiplication table for {num}:")
    for i in range(1, 11):
        print(f"{num} x {i} = {num * i}")

# ============================
# 100. Basic Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\nContact Book:")
        print("1. Add Contact")
        print("2. View Contacts")
        print("3. Search Contact")
        print("4. Exit")
        
        choice = input("Choose an option: ")
        
        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact for {name} added.")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts available.")
        elif choice == '3':
            name = input("Enter name to search: ")
            if name in contacts:
                print(f"{name}: {contacts[name]}")
            else:
                print("Contact not found.")
        elif choice == '4':
            print("Exiting the Contact Book. Goodbye!")
            break
        else:
            print("Invalid option, try again.")
# ============================
# 101. Dice Rolling Simulator
# ============================
import random

def dice_rolling_simulator():
    print("Welcome to the Dice Rolling Simulator!")
    while True:
        input("Press Enter to roll the dice...")
        roll = random.randint(1, 6)
        print(f"You rolled a {roll}!")
        again = input("Do you want to roll again? (y/n): ")
        if again.lower() != 'y':
            print("Thanks for playing!")
            break

# ============================
# 102. Password Strength Checker
# ============================
import re

def password_strength_checker():
    password = input("Enter a password: ")
    
    if len(password) < 8:
        print("Password too short!")
    elif not re.search("[A-Z]", password):
        print("Password must contain at least one uppercase letter.")
    elif not re.search("[a-z]", password):
        print("Password must contain at least one lowercase letter.")
    elif not re.search("[0-9]", password):
        print("Password must contain at least one number.")
    elif not re.search("[!@#$%^&*(),.?\":{}|<>]", password):
        print("Password must contain at least one special character.")
    else:
        print("Password is strong!")

# ============================
# 103. Calendar Generator
# ============================
import calendar

def calendar_generator():
    year = int(input("Enter the year: "))
    month = int(input("Enter the month: "))
    print(calendar.month(year, month))

# ============================
# 104. Binary to Decimal Converter
# ============================
def binary_to_decimal():
    binary = input("Enter a binary number: ")
    decimal = int(binary, 2)
    print(f"The decimal equivalent of {binary} is {decimal}.")

# ============================
# 105. Decimal to Binary Converter
# ============================
def decimal_to_binary():
    decimal = int(input("Enter a decimal number: "))
    binary = bin(decimal)[2:]
    print(f"The binary equivalent of {decimal} is {binary}.")

# ============================
# 106. Tic-Tac-Toe Game
# ============================
def print_board(board):
    print("\n")
    for row in board:
        print(" | ".join(row))
        print("-" * 5)

def check_winner(board):
    # Check rows, columns, and diagonals
    for i in range(3):
        if board[i][0] == board[i][1] == board[i][2] != ' ':
            return True
        if board[0][i] == board[1][i] == board[2][i] != ' ':
            return True
    if board[0][0] == board[1][1] == board[2][2] != ' ':
        return True
    if board[0][2] == board[1][1] == board[2][0] != ' ':
        return True
    return False

def tic_tac_toe():
    board = [[' ' for _ in range(3)] for _ in range(3)]
    current_player = 'X'
    
    while True:
        print_board(board)
        row = int(input(f"Player {current_player}, enter the row (0, 1, or 2): "))
        col = int(input(f"Player {current_player}, enter the column (0, 1, or 2): "))
        
        if board[row][col] == ' ':
            board[row][col] = current_player
        else:
            print("Cell already taken. Try again.")
            continue
        
        if check_winner(board):
            print_board(board)
            print(f"Player {current_player} wins!")
            break
        
        current_player = 'O' if current_player == 'X' else 'X'

# ============================
# 107. Countdown Timer
# ============================
import time

def countdown_timer():
    seconds = int(input("Enter time in seconds: "))
    
    while seconds > 0:
        mins, secs = divmod(seconds, 60)
        time_format = '{:02d}:{:02d}'.format(mins, secs)
        print(time_format, end='\r')
        time.sleep(1)
        seconds -= 1
    
    print("Time's up!")

# ============================
# 108. Loan EMI Calculator
# ============================
def loan_emi_calculator():
    principal = float(input("Enter the loan amount: "))
    rate_of_interest = float(input("Enter the rate of interest per year (%): "))
    time_in_years = float(input("Enter the loan tenure in years: "))
    
    rate_of_interest /= (12 * 100)  # Monthly interest
    time_in_months = time_in_years * 12  # Convert years to months
    
    emi = (principal * rate_of_interest * (1 + rate_of_interest) ** time_in_months) / ((1 + rate_of_interest) ** time_in_months - 1)
    print(f"Your monthly EMI is: {emi:.2f}")

# ============================
# 109. Leap Year Checker
# ============================
def leap_year_checker():
    year = int(input("Enter a year: "))
    if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
        print(f"{year} is a leap year.")
    else:
        print(f"{year} is not a leap year.")

# ============================
# 110. Rock, Paper, Scissors Game
# ============================
import random

def rock_paper_scissors():
    choices = ['rock', 'paper', 'scissors']
    while True:
        user_choice = input("Enter rock, paper, or scissors: ").lower()
        if user_choice not in choices:
            print("Invalid choice! Try again.")
            continue
        
        computer_choice = random.choice(choices)
        print(f"Computer chose: {computer_choice}")
        
        if user_choice == computer_choice:
            print("It's a tie!")
        elif (user_choice == 'rock' and computer_choice == 'scissors') or (user_choice == 'paper' and computer_choice == 'rock') or (user_choice == 'scissors' and computer_choice == 'paper'):
            print("You win!")
        else:
            print("You lose!")
        
        play_again = input("Do you want to play again? (y/n): ")
        if play_again.lower() != 'y':
            break

# ============================
# 111. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birth_date = input("Enter your birth date (YYYY-MM-DD): ")
    birth_date = datetime.strptime(birth_date, "%Y-%m-%d")
    today = datetime.today()
    age = today.year - birth_date.year - ((today.month, today.day) < (birth_date.month, birth_date.day))
    print(f"Your age is: {age} years")

# ============================
# 112. Simple Alarm Clock
# ============================
import time
import winsound

def alarm_clock():
    alarm_time = input("Enter the time for the alarm (HH:MM): ")
    while True:
        current_time = time.strftime("%H:%M")
        if current_time == alarm_time:
            print("Time's up! Wake up!")
            winsound.Beep(1000, 1000)  # Beep sound
            break
        time.sleep(60)  # Wait for one minute

# ============================
# 113. Currency Converter
# ============================
def currency_converter():
    amount = float(input("Enter amount in USD: "))
    currency_rate = 74.57  # Example: USD to INR conversion rate
    converted_amount = amount * currency_rate
    print(f"{amount} USD is equal to {converted_amount} INR")

# ============================
# 114. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms in the Fibonacci sequence: "))
    a, b = 0, 1
    print("Fibonacci Sequence:")
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 115. Simple Interest Calculator
# ============================
def simple_interest_calculator():
    principal = float(input("Enter the principal amount: "))
    rate = float(input("Enter the rate of interest (%): "))
    time = float(input("Enter the time (in years): "))
    interest = (principal * rate * time) / 100
    print(f"Simple interest: {interest}")

# ============================
# 116. Hangman Game
# ============================
import random

def hangman():
    word_list = ['python', 'java', 'ruby', 'javascript']
    word = random.choice(word_list)
    guessed_word = ['_'] * len(word)
    attempts = 6

    print("Welcome to Hangman!")
    while attempts > 0:
        print(" ".join(guessed_word))
        guess = input(f"You have {attempts} attempts left. Enter a letter: ").lower()
        
        if guess in word:
            for i in range(len(word)):
                if word[i] == guess:
                    guessed_word[i] = guess
            print("Good guess!")
        else:
            attempts -= 1
            print("Wrong guess!")
        
        if '_' not in guessed_word:
            print(f"Congratulations, you guessed the word {word}!")
            break
    else:
        print(f"Game over! The word was {word}.")

# ============================
# 117. To-Do List Application
# ============================
def todo_list():
    tasks = []
    
    while True:
        print("\nTo-Do List Application:")
        print("1. Add task")
        print("2. View tasks")
        print("3. Delete task")
        print("4. Exit")
        choice = input("Enter your choice: ")

        if choice == '1':
            task = input("Enter task description: ")
            tasks.append(task)
            print(f"Task '{task}' added.")
        elif choice == '2':
            if tasks:
                print("Your tasks:")
                for idx, task in enumerate(tasks, 1):
                    print(f"{idx}. {task}")
            else:
                print("No tasks yet.")
        elif choice == '3':
            task_number = int(input("Enter task number to delete: "))
            if 1 <= task_number <= len(tasks):
                removed_task = tasks.pop(task_number - 1)
                print(f"Task '{removed_task}' deleted.")
            else:
                print("Invalid task number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 118. Binary Search Algorithm
# ============================
def binary_search(arr, target):
    low, high = 0, len(arr) - 1
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            low = mid + 1
        else:
            high = mid - 1
    return -1

def binary_search_program():
    arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
    target = int(input("Enter the number to search: "))
    result = binary_search(arr, target)
    
    if result != -1:
        print(f"Number found at index {result}.")
    else:
        print("Number not found.")

# ============================
# 119. Prime Number Checker
# ============================
def prime_number_checker():
    number = int(input("Enter a number: "))
    
    if number < 2:
        print(f"{number} is not a prime number.")
        return
    
    for i in range(2, int(number**0.5) + 1):
        if number % i == 0:
            print(f"{number} is not a prime number.")
            return
    print(f"{number} is a prime number.")

# ============================
# 120. Matrix Multiplication
# ============================
def matrix_multiplication():
    rows_a = int(input("Enter number of rows for Matrix A: "))
    cols_a = int(input("Enter number of columns for Matrix A: "))
    matrix_a = []
    print("Enter elements of Matrix A:")
    for _ in range(rows_a):
        matrix_a.append([int(x) for x in input().split()])

    rows_b = int(input("Enter number of rows for Matrix B: "))
    cols_b = int(input("Enter number of columns for Matrix B: "))
    if cols_a != rows_b:
        print("Matrix multiplication not possible!")
        return
    
    matrix_b = []
    print("Enter elements of Matrix B:")
    for _ in range(rows_b):
        matrix_b.append([int(x) for x in input().split()])

    result = [[0 for _ in range(cols_b)] for _ in range(rows_a)]

    for i in range(rows_a):
        for j in range(cols_b):
            for k in range(cols_a):
                result[i][j] += matrix_a[i][k] * matrix_b[k][j]
    
    print("Resulting Matrix:")
    for row in result:
        print(" ".join(map(str, row)))

# ============================
# 121. Email Slicer
# ============================
def email_slicer():
    email = input("Enter your email: ")
    username, domain = email.split('@')
    print(f"Your username is: {username}")
    print(f"Your domain is: {domain}")

# ============================
# 122. Countdown Timer
# ============================
import time

def countdown_timer():
    t = int(input("Enter the time for countdown (in seconds): "))
    while t:
        mins, secs = divmod(t, 60)
        timeformat = '{:02d}:{:02d}'.format(mins, secs)
        print(timeformat, end='\r')
        time.sleep(1)
        t -= 1
    print("Time's up!")

# ============================
# 123. Password Strength Checker
# ============================
import re

def password_strength_checker():
    password = input("Enter your password: ")
    if len(password) < 8:
        print("Password is too short!")
    elif not re.search("[A-Z]", password):
        print("Password must contain at least one uppercase letter.")
    elif not re.search("[0-9]", password):
        print("Password must contain at least one digit.")
    elif not re.search("[@#$%^&+=]", password):
        print("Password must contain at least one special character.")
    else:
        print("Password is strong!")

# ============================
# 124. Random Joke Generator
# ============================
import requests

def random_joke_generator():
    response = requests.get("https://official-joke-api.appspot.com/random_joke")
    joke = response.json()
    print(f"Here's a joke: {joke['setup']}")
    print(f"{joke['punchline']}")

# ============================
# 125. Contact Book
# ============================
def contact_book():
    contacts = {}
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Search Contact\n4. Exit")
        choice = input("Enter your choice: ")

        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact {name} added.")
        elif choice == '2':
            if contacts:
                for name, phone in contacts.items():
                    print(f"Name: {name}, Phone: {phone}")
            else:
                print("No contacts in the book.")
        elif choice == '3':
            name = input("Enter name to search: ")
            if name in contacts:
                print(f"Phone number of {name}: {contacts[name]}")
            else:
                print("Contact not found.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 126. Basic Calculator with GUI
# ============================
import tkinter as tk

def basic_calculator_gui():
    def click(button_text):
        current = entry.get()
        entry.delete(0, tk.END)
        entry.insert(tk.END, current + button_text)

    def clear():
        entry.delete(0, tk.END)

    def calculate():
        try:
            result = eval(entry.get())
            entry.delete(0, tk.END)
            entry.insert(tk.END, result)
        except:
            entry.delete(0, tk.END)
            entry.insert(tk.END, "Error")

    root = tk.Tk()
    root.title("Basic Calculator")

    entry = tk.Entry(root, width=20, font=("Arial", 24), borderwidth=2, relief="solid")
    entry.grid(row=0, column=0, columnspan=4)

    buttons = [
        ('7', 1, 0), ('8', 1, 1), ('9', 1, 2), ('/', 1, 3),
        ('4', 2, 0), ('5', 2, 1), ('6', 2, 2), ('*', 2, 3),
        ('1', 3, 0), ('2', 3, 1), ('3', 3, 2), ('-', 3, 3),
        ('0', 4, 0), ('.', 4, 1), ('+', 4, 2), ('=', 4, 3)
    ]

    for (text, row, col) in buttons:
        button = tk.Button(root, text=text, font=("Arial", 18), width=5, height=2, command=lambda text=text: click(text) if text != '=' else calculate())
        button.grid(row=row, column=col)

    clear_button = tk.Button(root, text="C", font=("Arial", 18), width=5, height=2, command=clear)
    clear_button.grid(row=5, column=0, columnspan=2)

    root.mainloop()

# ============================
# 127. Simple Chatbot
# ============================
def simple_chatbot():
    responses = {
        "hello": "Hi there! How can I help you?",
        "how are you": "I'm doing great, thanks for asking!",
        "bye": "Goodbye! Have a great day!",
        "default": "I'm sorry, I didn't understand that."
    }
    
    print("Chatbot: Hello! Type 'bye' to exit.")
    while True:
        user_input = input("You: ").lower()
        if user_input == 'bye':
            print("Chatbot: Goodbye!")
            break
        else:
            print(f"Chatbot: {responses.get(user_input, responses['default'])}")

# ============================
# 128. Word Count in a Text
# ============================
def word_count():
    text = input("Enter a sentence: ")
    words = text.split()
    print(f"Word count: {len(words)}")

# ============================
# 129. Simple Voting System
# ============================
def voting_system():
    candidates = ["Alice", "Bob", "Charlie"]
    votes = {candidate: 0 for candidate in candidates}
    
    while True:
        print("\nCandidates:")
        for idx, candidate in enumerate(candidates, 1):
            print(f"{idx}. {candidate}")
        
        choice = int(input("Enter the number of the candidate you want to vote for (0 to exit): "))
        if choice == 0:
            break
        elif 1 <= choice <= len(candidates):
            votes[candidates[choice - 1]] += 1
        else:
            print("Invalid choice!")
    
    print("\nVoting results:")
    for candidate, vote in votes.items():
        print(f"{candidate}: {vote} votes")

# ============================
# 130. Guess the Number Game
# ============================
import random

def guess_the_number():
    number = random.randint(1, 100)
    attempts = 0
    
    print("Welcome to 'Guess the Number' game!")
    while True:
        guess = int(input("Guess the number (between 1 and 100): "))
        attempts += 1
        
        if guess < number:
            print("Too low! Try again.")
        elif guess > number:
            print("Too high! Try again.")
        else:
            print(f"Congratulations! You guessed the number {number} in {attempts} attempts.")
            break
# ============================
# 131. To-Do List Application
# ============================
def todo_list():
    tasks = []
    while True:
        print("\n1. Add Task\n2. View Tasks\n3. Remove Task\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            task = input("Enter the task: ")
            tasks.append(task)
            print(f"Task '{task}' added.")
        elif choice == '2':
            if tasks:
                print("\nYour Tasks:")
                for idx, task in enumerate(tasks, 1):
                    print(f"{idx}. {task}")
            else:
                print("No tasks found.")
        elif choice == '3':
            if tasks:
                task_num = int(input("Enter task number to remove: "))
                if 1 <= task_num <= len(tasks):
                    removed_task = tasks.pop(task_num - 1)
                    print(f"Task '{removed_task}' removed.")
                else:
                    print("Invalid task number.")
            else:
                print("No tasks to remove.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 132. Currency Converter
# ============================
import requests

def currency_converter():
    print("Welcome to the currency converter!")
    base_currency = input("Enter the base currency (e.g., USD): ")
    target_currency = input("Enter the target currency (e.g., EUR): ")
    amount = float(input("Enter the amount: "))
    
    url = f"https://api.exchangerate-api.com/v4/latest/{base_currency}"
    response = requests.get(url).json()
    
    if target_currency in response['rates']:
        converted_amount = amount * response['rates'][target_currency]
        print(f"{amount} {base_currency} is equal to {converted_amount} {target_currency}.")
    else:
        print("Invalid currency code.")

# ============================
# 133. Simple Alarm Clock
# ============================
import time
import winsound

def alarm_clock():
    alarm_time = input("Enter the time for the alarm (HH:MM:SS): ")
    print("Waiting for alarm...")
    while True:
        current_time = time.strftime("%H:%M:%S")
        if current_time == alarm_time:
            print("Time's up! Alarm ringing...")
            winsound.Beep(1000, 1000)
            break
        time.sleep(1)

# ============================
# 134. Birthday Reminder
# ============================
from datetime import datetime

def birthday_reminder():
    birthdays = {}
    
    while True:
        print("\n1. Add Birthday\n2. View Birthdays\n3. Check Today's Birthdays\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter name: ")
            date_str = input("Enter birthday (YYYY-MM-DD): ")
            date = datetime.strptime(date_str, "%Y-%m-%d")
            birthdays[name] = date
            print(f"Birthday for {name} added.")
        elif choice == '2':
            if birthdays:
                print("\nBirthdays List:")
                for name, date in birthdays.items():
                    print(f"{name}: {date.strftime('%Y-%m-%d')}")
            else:
                print("No birthdays saved.")
        elif choice == '3':
            today = datetime.today()
            print("\nToday's Birthdays:")
            for name, date in birthdays.items():
                if date.month == today.month and date.day == today.day:
                    print(f"{name}: {date.strftime('%Y-%m-%d')}")
            else:
                print("No birthdays today.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 135. Flashcard Quiz App
# ============================
def flashcard_quiz():
    flashcards = {
        "Python": "A high-level programming language",
        "HTML": "Standard markup language for web pages",
        "CSS": "Style sheet language used for web page styling"
    }
    
    print("Welcome to the Flashcard Quiz App!")
    
    for term, definition in flashcards.items():
        print(f"Term: {term}")
        input("Press Enter to see the definition...")
        print(f"Definition: {definition}")
        print("------------")

# ============================
# 136. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birthdate_str = input("Enter your birthdate (YYYY-MM-DD): ")
    birthdate = datetime.strptime(birthdate_str, "%Y-%m-%d")
    today = datetime.today()
    
    age = today.year - birthdate.year
    if today.month < birthdate.month or (today.month == birthdate.month and today.day < birthdate.day):
        age -= 1
    print(f"You are {age} years old.")

# ============================
# 137. Random Number Generator
# ============================
import random

def random_number_generator():
    start = int(input("Enter the starting number: "))
    end = int(input("Enter the ending number: "))
    
    random_number = random.randint(start, end)
    print(f"The random number between {start} and {end} is: {random_number}")

# ============================
# 138. Simple Tic-Tac-Toe Game
# ============================
def print_board(board):
    print("\n")
    print(" | ".join(board[0:3]))
    print("---------")
    print(" | ".join(board[3:6]))
    print("---------")
    print(" | ".join(board[6:9]))
    print("\n")

def tic_tac_toe():
    board = [' ' for _ in range(9)]
    current_player = 'X'
    
    print("Welcome to Tic-Tac-Toe!")
    
    for i in range(9):
        print_board(board)
        position = int(input(f"Player {current_player}, choose a position (1-9): ")) - 1
        if board[position] == ' ':
            board[position] = current_player
            if (board[0] == board[1] == board[2] or
                board[3] == board[4] == board[5] or
                board[6] == board[7] == board[8] or
                board[0] == board[3] == board[6] or
                board[1] == board[4] == board[7] or
                board[2] == board[5] == board[8] or
                board[0] == board[4] == board[8] or
                board[2] == board[4] == board[6]):
                print_board(board)
                print(f"Player {current_player} wins!")
                return
            current_player = 'O' if current_player == 'X' else 'X'
        else:
            print("Position already taken! Try again.")
    
    print_board(board)
    print("It's a tie!")

# ============================
# 139. Simple Dice Roller
# ============================
import random

def dice_roller():
    roll = input("Roll the dice? (yes/no): ").lower()
    
    while roll == "yes":
        dice = random.randint(1, 6)
        print(f"You rolled a {dice}")
        roll = input("Roll again? (yes/no): ").lower()
    
    print("Goodbye!")

# ============================
# 140. Countdown Timer with Sound
# ============================
import time
import winsound

def countdown_with_sound():
    t = int(input("Enter the time for countdown (in seconds): "))
    while t:
        mins, secs = divmod(t, 60)
        timeformat = '{:02d}:{:02d}'.format(mins, secs)
        print(timeformat, end='\r')
        time.sleep(1)
        t -= 1
    print("Time's up!")
    winsound.Beep(1000, 1000)

# ============================
# 141. Weather App
# ============================
import requests

def weather_app():
    city = input("Enter city name: ")
    api_key = "your_api_key_here"
    base_url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    
    response = requests.get(base_url).json()
    
    if response['cod'] == 200:
        main = response['main']
        wind = response['wind']
        weather_desc = response['weather'][0]['description']
        temperature = main['temp']
        humidity = main['humidity']
        wind_speed = wind['speed']
        
        print(f"Weather in {city}:")
        print(f"Description: {weather_desc.capitalize()}")
        print(f"Temperature: {temperature}°C")
        print(f"Humidity: {humidity}%")
        print(f"Wind Speed: {wind_speed} m/s")
    else:
        print("City not found.")

# ============================
# 142. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number_to_guess = random.randint(1, 100)
    attempts = 0
    
    print("Welcome to the Number Guessing Game!")
    print("Guess the number between 1 and 100.")
    
    while True:
        guess = int(input("Enter your guess: "))
        attempts += 1
        
        if guess < number_to_guess:
            print("Too low! Try again.")
        elif guess > number_to_guess:
            print("Too high! Try again.")
        else:
            print(f"Correct! You guessed the number in {attempts} attempts.")
            break

# ============================
# 143. Mad Libs Game
# ============================
def mad_libs():
    print("Welcome to Mad Libs Game!")
    adjective = input("Enter an adjective: ")
    noun = input("Enter a noun: ")
    verb = input("Enter a verb: ")
    adverb = input("Enter an adverb: ")
    
    print(f"\nHere is your story:\n")
    print(f"The {adjective} {noun} decided to {verb} {adverb}.")

# ============================
# 144. Simple Chatbot
# ============================
def chatbot():
    print("Hello! I am a chatbot. How can I assist you today?")
    
    while True:
        user_input = input("You: ")
        if user_input.lower() in ['hi', 'hello']:
            print("Chatbot: Hello! How can I help you today?")
        elif 'bye' in user_input.lower():
            print("Chatbot: Goodbye! Have a nice day.")
            break
        else:
            print(f"Chatbot: You said {user_input}. Sorry, I don't understand.")

# ============================
# 145. Countdown Timer with Logging
# ============================
import time

def countdown_timer_with_logging():
    time_in_sec = int(input("Enter countdown time in seconds: "))
    print("Countdown started...")
    while time_in_sec > 0:
        mins, secs = divmod(time_in_sec, 60)
        print(f"{mins:02d}:{secs:02d}", end="\r")
        time.sleep(1)
        time_in_sec -= 1
    print("Time's up!")
    log_time()

def log_time():
    with open("time_log.txt", "a") as file:
        file.write("Countdown completed at: " + time.strftime("%Y-%m-%d %H:%M:%S") + "\n")
    print("Time logged to time_log.txt.")

# ============================
# 146. Email Slicer
# ============================
def email_slicer():
    email = input("Enter your email address: ")
    username, domain = email.split('@')
    print(f"Username: {username}")
    print(f"Domain: {domain}")

# ============================
# 147. Simple Calculator with GUI
# ============================
import tkinter as tk

def calculator_gui():
    def add():
        result_var.set(float(entry1.get()) + float(entry2.get()))
    
    def subtract():
        result_var.set(float(entry1.get()) - float(entry2.get()))
    
    def multiply():
        result_var.set(float(entry1.get()) * float(entry2.get()))
    
    def divide():
        try:
            result_var.set(float(entry1.get()) / float(entry2.get()))
        except ZeroDivisionError:
            result_var.set("Error! Div by 0")
    
    window = tk.Tk()
    window.title("Simple Calculator")
    
    entry1 = tk.Entry(window)
    entry1.grid(row=0, column=0)
    
    entry2 = tk.Entry(window)
    entry2.grid(row=0, column=1)
    
    result_var = tk.StringVar()
    result_label = tk.Label(window, textvariable=result_var)
    result_label.grid(row=1, column=0, columnspan=2)
    
    add_button = tk.Button(window, text="Add", command=add)
    add_button.grid(row=2, column=0)
    
    subtract_button = tk.Button(window, text="Subtract", command=subtract)
    subtract_button.grid(row=2, column=1)
    
    multiply_button = tk.Button(window, text="Multiply", command=multiply)
    multiply_button.grid(row=3, column=0)
    
    divide_button = tk.Button(window, text="Divide", command=divide)
    divide_button.grid(row=3, column=1)
    
    window.mainloop()

# ============================
# 148. Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Remove Contact\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter contact name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact for {name} added.")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts found.")
        elif choice == '3':
            name = input("Enter the name of the contact to remove: ")
            if name in contacts:
                del contacts[name]
                print(f"Contact for {name} removed.")
            else:
                print(f"No contact found for {name}.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 149. File Renamer
# ============================
import os

def file_renamer():
    path = input("Enter directory path: ")
    prefix = input("Enter prefix to add to files: ")
    
    files = os.listdir(path)
    
    for file in files:
        if os.path.isfile(os.path.join(path, file)):
            new_name = prefix + file
            os.rename(os.path.join(path, file), os.path.join(path, new_name))
            print(f"Renamed: {file} to {new_name}")
    
    print("File renaming completed.")

# ============================
# 150. Image to Grayscale Converter
# ============================
from PIL import Image

def image_to_grayscale():
    image_path = input("Enter image file path: ")
    image = Image.open(image_path)
    grayscale_image = image.convert("L")
    grayscale_image.save("grayscale_image.png")
    grayscale_image.show()
    print("Image converted to grayscale and saved as 'grayscale_image.png'.")

# ============================
# 151. Simple Stopwatch
# ============================
import time

def simple_stopwatch():
    input("Press Enter to start the stopwatch...")
    start_time = time.time()
    
    input("Press Enter to stop the stopwatch...")
    end_time = time.time()
    
    elapsed_time = end_time - start_time
    print(f"Elapsed time: {elapsed_time:.2f} seconds")

# ============================
# 152. Dice Roller
# ============================
import random

def dice_roller():
    roll_again = "yes"
    
    while roll_again.lower() == "yes":
        print(f"Rolling the dice... You got: {random.randint(1, 6)}")
        roll_again = input("Do you want to roll again? (yes/no): ")

# ============================
# 153. Prime Number Checker
# ============================
def prime_number_checker():
    number = int(input("Enter a number to check if it is prime: "))
    
    if number > 1:
        for i in range(2, int(number / 2) + 1):
            if (number % i) == 0:
                print(f"{number} is not a prime number.")
                break
        else:
            print(f"{number} is a prime number.")
    else:
        print(f"{number} is not a prime number.")

# ============================
# 154. Palindrome Checker
# ============================
def palindrome_checker():
    string = input("Enter a string to check if it's a palindrome: ")
    if string == string[::-1]:
        print(f"{string} is a palindrome.")
    else:
        print(f"{string} is not a palindrome.")

# ============================
# 155. To-Do List
# ============================
def todo_list():
    tasks = []
    
    while True:
        print("\n1. Add Task\n2. View Tasks\n3. Remove Task\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            task = input("Enter task: ")
            tasks.append(task)
            print(f"Task '{task}' added.")
        elif choice == '2':
            if tasks:
                print("\nYour To-Do List:")
                for index, task in enumerate(tasks, 1):
                    print(f"{index}. {task}")
            else:
                print("No tasks in the list.")
        elif choice == '3':
            task_index = int(input("Enter task number to remove: ")) - 1
            if 0 <= task_index < len(tasks):
                removed_task = tasks.pop(task_index)
                print(f"Task '{removed_task}' removed.")
            else:
                print("Invalid task number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 156. Tic-Tac-Toe Game
# ============================
def tic_tac_toe():
    board = [' ' for _ in range(9)]
    current_player = "X"
    
    def print_board():
        print(f"{board[0]} | {board[1]} | {board[2]}")
        print("--+---+--")
        print(f"{board[3]} | {board[4]} | {board[5]}")
        print("--+---+--")
        print(f"{board[6]} | {board[7]} | {board[8]}")
    
    def check_winner():
        win_conditions = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
        for condition in win_conditions:
            if board[condition[0]] == board[condition[1]] == board[condition[2]] != ' ':
                return True
        return False
    
    while ' ' in board:
        print_board()
        move = int(input(f"Player {current_player}, enter your move (1-9): ")) - 1
        if board[move] == ' ':
            board[move] = current_player
            if check_winner():
                print_board()
                print(f"Player {current_player} wins!")
                break
            current_player = "O" if current_player == "X" else "X"
        else:
            print("Invalid move, try again.")
    
    if ' ' not in board:
        print_board()
        print("It's a draw!")

# ============================
# 157. Simple Alarm Clock
# ============================
import datetime
import time

def alarm_clock():
    alarm_time = input("Enter the alarm time in HH:MM format: ")
    alarm_hour, alarm_minute = map(int, alarm_time.split(":"))
    
    while True:
        current_time = datetime.datetime.now().strftime("%H:%M")
        print(f"Current time: {current_time}", end="\r")
        if current_time == f"{alarm_hour:02d}:{alarm_minute:02d}":
            print("\nAlarm ringing! Time's up!")
            break
        time.sleep(60)

# ============================
# 158. Currency Converter
# ============================
def currency_converter():
    amount = float(input("Enter the amount in USD: "))
    currency = input("Enter the target currency (e.g., EUR, INR, GBP): ").upper()
    
    exchange_rates = {
        "EUR": 0.85,  # Example rate
        "INR": 75.0,  # Example rate
        "GBP": 0.74   # Example rate
    }
    
    if currency in exchange_rates:
        converted_amount = amount * exchange_rates[currency]
        print(f"{amount} USD is equal to {converted_amount} {currency}.")
    else:
        print("Currency not supported.")

# ============================
# 159. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms: "))
    a, b = 0, 1
    print("Fibonacci Sequence:")
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 160. Binary Search
# ============================
def binary_search():
    arr = [int(x) for x in input("Enter sorted numbers separated by space: ").split()]
    target = int(input("Enter the number to search: "))
    
    low, high = 0, len(arr) - 1
    found = False
    
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] == target:
            found = True
            break
        elif arr[mid] < target:
            low = mid + 1
        else:
            high = mid - 1
    
    if found:
        print(f"Number {target} found at index {mid}.")
    else:
        print(f"Number {target} not found in the list.")

# ============================
# 161. Countdown Timer
# ============================
import time

def countdown_timer():
    total_seconds = int(input("Enter countdown time in seconds: "))
    while total_seconds > 0:
        minutes, seconds = divmod(total_seconds, 60)
        print(f"Time left: {minutes:02d}:{seconds:02d}", end="\r")
        time.sleep(1)
        total_seconds -= 1
    print("Time's up!")

# ============================
# 162. Weather App (API based)
# ============================
import requests

def weather_app():
    city = input("Enter the city name: ")
    api_key = "your_api_key_here"  # Replace with your own API key
    url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}"
    
    response = requests.get(url)
    data = response.json()
    
    if response.status_code == 200:
        temp = data['main']['temp'] - 273.15  # Convert from Kelvin to Celsius
        weather = data['weather'][0]['description']
        print(f"Weather in {city}: {weather}")
        print(f"Temperature: {temp:.2f}°C")
    else:
        print(f"City {city} not found!")

# ============================
# 163. Simple Calculator
# ============================
def simple_calculator():
    num1 = float(input("Enter first number: "))
    operator = input("Enter operator (+, -, *, /): ")
    num2 = float(input("Enter second number: "))
    
    if operator == "+":
        result = num1 + num2
    elif operator == "-":
        result = num1 - num2
    elif operator == "*":
        result = num1 * num2
    elif operator == "/":
        result = num1 / num2
    else:
        print("Invalid operator!")
        return
    
    print(f"Result: {result}")

# ============================
# 164. Simple Chatbot
# ============================
def simple_chatbot():
    print("Hello! I'm a simple chatbot. Type 'exit' to end the conversation.")
    while True:
        user_input = input("You: ")
        
        if user_input.lower() == "exit":
            print("Goodbye!")
            break
        elif "how are you" in user_input.lower():
            print("Chatbot: I'm doing well, thank you!")
        elif "hello" in user_input.lower():
            print("Chatbot: Hello! How can I assist you today?")
        else:
            print("Chatbot: Sorry, I didn't understand that.")

# ============================
# 165. Text-based Adventure Game
# ============================
def adventure_game():
    print("Welcome to the Adventure Game!")
    print("You are in a forest. There are two paths ahead.")
    print("1. Take the left path")
    print("2. Take the right path")
    
    choice = input("Which path do you choose (1/2): ")
    
    if choice == "1":
        print("You took the left path and encountered a dragon!")
        action = input("Do you fight or run? (fight/run): ")
        if action == "fight":
            print("You bravely fought the dragon and won! You are a hero!")
        else:
            print("You ran away and safely returned to the forest entrance.")
    elif choice == "2":
        print("You took the right path and found a treasure chest!")
        action = input("Do you open it or leave it? (open/leave): ")
        if action == "open":
            print("You found a pile of gold! You're rich!")
        else:
            print("You left the treasure chest and continued walking.")
    else:
        print("Invalid choice. Please choose 1 or 2.")

# ============================
# 166. Basic Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Search Contact\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact {name} added.")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts in the list.")
        elif choice == '3':
            name = input("Enter the name to search: ")
            if name in contacts:
                print(f"Contact found: {name}: {contacts[name]}")
            else:
                print(f"No contact found with the name {name}.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 167. Simple Password Generator
# ============================
import random
import string

def password_generator():
    length = int(input("Enter the length of the password: "))
    characters = string.ascii_letters + string.digits + string.punctuation
    password = ''.join(random.choice(characters) for _ in range(length))
    print(f"Generated password: {password}")

# ============================
# 168. Basic Quiz Game
# ============================
def quiz_game():
    questions = [
        {"question": "What is the capital of France?", "answer": "Paris"},
        {"question": "What is 2 + 2?", "answer": "4"},
        {"question": "Who is the author of '1984'?", "answer": "George Orwell"},
    ]
    
    score = 0
    for q in questions:
        answer = input(q["question"] + " ")
        if answer.lower() == q["answer"].lower():
            score += 1
    
    print(f"You got {score}/{len(questions)} correct!")

# ============================
# 169. BMI Calculator
# ============================
def bmi_calculator():
    height = float(input("Enter your height in meters: "))
    weight = float(input("Enter your weight in kilograms: "))
    
    bmi = weight / (height ** 2)
    print(f"Your BMI is: {bmi:.2f}")
    
    if bmi < 18.5:
        print("You are underweight.")
    elif 18.5 <= bmi < 24.9:
        print("You have a normal weight.")
    elif 25 <= bmi < 29.9:
        print("You are overweight.")
    else:
        print("You are obese.")

# ============================
# 170. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number = random.randint(1, 100)
    attempts = 0
    print("Welcome to the Number Guessing Game!")
    print("I have chosen a number between 1 and 100. Try to guess it.")
    
    while True:
        guess = int(input("Enter your guess: "))
        attempts += 1
        
        if guess < number:
            print("Too low!")
        elif guess > number:
            print("Too high!")
        else:
            print(f"Congratulations! You've guessed the number in {attempts} attempts.")
            break

# ============================
# 171. Tic-Tac-Toe Game
# ============================
def print_board(board):
    for row in board:
        print(" | ".join(row))
        print("-" * 5)

def tic_tac_toe():
    board = [[" " for _ in range(3)] for _ in range(3)]
    current_player = "X"
    winner = None
    
    while winner is None:
        print_board(board)
        row = int(input(f"Player {current_player}, enter row (0, 1, 2): "))
        col = int(input(f"Player {current_player}, enter column (0, 1, 2): "))
        
        if board[row][col] == " ":
            board[row][col] = current_player
            winner = check_winner(board)
            current_player = "O" if current_player == "X" else "X"
        else:
            print("Cell already taken! Try again.")
    
    print_board(board)
    print(f"Player {winner} wins!")

def check_winner(board):
    for row in board:
        if row[0] == row[1] == row[2] and row[0] != " ":
            return row[0]
    
    for col in range(3):
        if board[0][col] == board[1][col] == board[2][col] and board[0][col] != " ":
            return board[0][col]
    
    if board[0][0] == board[1][1] == board[2][2] and board[0][0] != " ":
        return board[0][0]
    
    if board[0][2] == board[1][1] == board[2][0] and board[0][2] != " ":
        return board[0][2]
    
    return None

# ============================
# 172. Flashcard App
# ============================
def flashcard_app():
    flashcards = {
        "What is the capital of France?": "Paris",
        "What is 5 + 5?": "10",
        "What color is the sky?": "Blue",
    }
    
    for question, answer in flashcards.items():
        print(f"Question: {question}")
        input("Press Enter to see the answer.")
        print(f"Answer: {answer}")
        print("-" * 30)

# ============================
# 173. Simple Alarm Clock
# ============================
import time
import winsound

def alarm_clock():
    alarm_time = input("Enter alarm time (HH:MM AM/PM): ")
    alarm_hour, alarm_minute = map(int, alarm_time[:-6].split(":"))
    if alarm_time[-2:].upper() == "PM" and alarm_hour != 12:
        alarm_hour += 12
    if alarm_time[-2:].upper() == "AM" and alarm_hour == 12:
        alarm_hour = 0
    
    print("Waiting for alarm...")
    
    while True:
        current_time = time.localtime()
        if current_time.tm_hour == alarm_hour and current_time.tm_min == alarm_minute:
            print("Alarm Time!")
            winsound.Beep(1000, 1000)  # Beep sound
            break
        time.sleep(30)

# ============================
# 174. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birth_date = input("Enter your birth date (YYYY-MM-DD): ")
    birth_date = datetime.strptime(birth_date, "%Y-%m-%d")
    today = datetime.today()
    
    age = today.year - birth_date.year
    if today.month < birth_date.month or (today.month == birth_date.month and today.day < birth_date.day):
        age -= 1
    
    print(f"You are {age} years old.")

# ============================
# 175. To-Do List App
# ============================
def todo_list():
    todos = []
    
    while True:
        print("\n1. Add Todo\n2. View Todos\n3. Remove Todo\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            todo = input("Enter a new todo: ")
            todos.append(todo)
            print(f"Todo '{todo}' added.")
        elif choice == '2':
            if todos:
                print("\nYour Todos:")
                for i, todo in enumerate(todos, 1):
                    print(f"{i}. {todo}")
            else:
                print("No todos found.")
        elif choice == '3':
            todo_num = int(input("Enter the number of the todo to remove: "))
            if 0 < todo_num <= len(todos):
                removed_todo = todos.pop(todo_num - 1)
                print(f"Removed todo: {removed_todo}")
            else:
                print("Invalid todo number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 176. Currency Converter
# ============================
def currency_converter():
    currencies = {
        "USD": 1,
        "EUR": 0.85,
        "GBP": 0.75,
        "INR": 74.85,
        "AUD": 1.35,
    }
    
    print("Available currencies: USD, EUR, GBP, INR, AUD")
    from_currency = input("Enter the currency to convert from: ").upper()
    to_currency = input("Enter the currency to convert to: ").upper()
    amount = float(input("Enter the amount: "))
    
    if from_currency in currencies and to_currency in currencies:
        converted_amount = amount * (currencies[to_currency] / currencies[from_currency])
        print(f"{amount} {from_currency} is equal to {converted_amount:.2f} {to_currency}.")
    else:
        print("Invalid currency.")

# ============================
# 177. Expense Tracker
# ============================
def expense_tracker():
    expenses = []
    
    while True:
        print("\n1. Add Expense\n2. View Expenses\n3. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            category = input("Enter the expense category: ")
            amount = float(input("Enter the expense amount: "))
            expenses.append({"category": category, "amount": amount})
            print(f"Added expense: {category} - {amount}")
        elif choice == '2':
            if expenses:
                print("\nYour Expenses:")
                total = 0
                for expense in expenses:
                    print(f"{expense['category']}: {expense['amount']}")
                    total += expense['amount']
                print(f"Total Expenses: {total}")
            else:
                print("No expenses recorded.")
        elif choice == '3':
            break
        else:
            print("Invalid choice!")

# ============================
# 178. Fibonacci Sequence
# ============================
def fibonacci_sequence(n):
    fib_sequence = [0, 1]
    while len(fib_sequence) < n:
        fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
    return fib_sequence

def print_fibonacci():
    n = int(input("Enter the number of terms: "))
    print(f"The first {n} terms of the Fibonacci sequence are:")
    print(fibonacci_sequence(n))

# ============================
# 179. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter your email: ")
    regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    
    if re.match(regex, email):
        print("Valid email!")
    else:
        print("Invalid email!")

# ============================
# 180. Prime Number Checker
# ============================
def prime_number_checker():
    number = int(input("Enter a number: "))
    if number < 2:
        print("Not a prime number.")
        return
    
    for i in range(2, int(number ** 0.5) + 1):
        if number % i == 0:
            print("Not a prime number.")
            return
    
    print("It's a prime number!")

# ============================
# 181. Weather App
# ============================
import requests

def weather_app():
    city = input("Enter the city name: ")
    api_key = "your_api_key_here"
    base_url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    response = requests.get(base_url)
    
    if response.status_code == 200:
        data = response.json()
        main_data = data["main"]
        weather_data = data["weather"][0]
        print(f"City: {city}")
        print(f"Temperature: {main_data['temp']}°C")
        print(f"Weather: {weather_data['description']}")
    else:
        print("City not found or invalid API key.")

# ============================
# 182. Countdown Timer
# ============================
import time

def countdown_timer():
    seconds = int(input("Enter time in seconds for countdown: "))
    
    while seconds >= 0:
        mins, secs = divmod(seconds, 60)
        time_format = f"{mins:02d}:{secs:02d}"
        print(time_format, end="\r")
        time.sleep(1)
        seconds -= 1
    
    print("Time's up!")

# ============================
# 183. Quiz Game
# ============================
def quiz_game():
    questions = {
        "What is the capital of USA?": "Washington D.C.",
        "Who developed Python?": "Guido van Rossum",
        "What is 2 + 2?": "4",
    }
    score = 0
    for question, correct_answer in questions.items():
        print(question)
        answer = input("Your answer: ")
        if answer.lower() == correct_answer.lower():
            score += 1
    
    print(f"Your score: {score}/{len(questions)}")

# ============================
# 184. Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Remove Contact\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Added contact: {name} - {phone}")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts found.")
        elif choice == '3':
            name = input("Enter the name of the contact to remove: ")
            if name in contacts:
                del contacts[name]
                print(f"Removed contact: {name}")
            else:
                print("Contact not found.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 185. Palindrome Checker
# ============================
def palindrome_checker():
    word = input("Enter a word: ")
    if word == word[::-1]:
        print(f"'{word}' is a palindrome!")
    else:
        print(f"'{word}' is not a palindrome.")

# ============================
# 186. Simple Chatbot
# ============================
def simple_chatbot():
    print("Hello, I am your chatbot. Type 'exit' to end the conversation.")
    while True:
        user_input = input("You: ")
        if user_input.lower() == 'exit':
            print("Goodbye!")
            break
        elif "hello" in user_input.lower():
            print("Chatbot: Hi there!")
        elif "how are you" in user_input.lower():
            print("Chatbot: I'm doing great, thank you!")
        else:
            print("Chatbot: I'm not sure how to respond to that.")

# ============================
# 187. Rock Paper Scissors
# ============================
import random

def rock_paper_scissors():
    choices = ["rock", "paper", "scissors"]
    user_choice = input("Enter rock, paper, or scissors: ").lower()
    if user_choice not in choices:
        print("Invalid choice.")
        return
    
    computer_choice = random.choice(choices)
    print(f"Computer chose: {computer_choice}")
    
    if user_choice == computer_choice:
        print("It's a tie!")
    elif (user_choice == "rock" and computer_choice == "scissors") or \
         (user_choice == "paper" and computer_choice == "rock") or \
         (user_choice == "scissors" and computer_choice == "paper"):
        print("You win!")
    else:
        print("You lose!")

# ============================
# 188. Currency Converter (Real-time rates)
# ============================
import requests

def real_time_currency_converter():
    base_currency = input("Enter the base currency (USD, EUR, etc.): ").upper()
    target_currency = input("Enter the target currency: ").upper()
    amount = float(input("Enter the amount: "))
    
    api_url = f"https://api.exchangerate-api.com/v4/latest/{base_currency}"
    response = requests.get(api_url)
    
    if response.status_code == 200:
        data = response.json()
        if target_currency in data['rates']:
            conversion_rate = data['rates'][target_currency]
            converted_amount = amount * conversion_rate
            print(f"{amount} {base_currency} = {converted_amount:.2f} {target_currency}")
        else:
            print("Target currency not found.")
    else:
        print("Error fetching exchange rates.")

# ============================
# 189. Simple Calculator (GUI)
# ============================
import tkinter as tk

def calculator_gui():
    def click_button(value):
        current = entry.get()
        entry.delete(0, tk.END)
        entry.insert(0, current + value)

    def clear():
        entry.delete(0, tk.END)

    def calculate():
        try:
            result = eval(entry.get())
            entry.delete(0, tk.END)
            entry.insert(0, result)
        except Exception as e:
            entry.delete(0, tk.END)
            entry.insert(0, "Error")

    window = tk.Tk()
    window.title("Calculator")
    
    entry = tk.Entry(window, width=20, font=('Arial', 20), bd=10, relief="solid", justify="right")
    entry.grid(row=0, column=0, columnspan=4)

    buttons = [
        ("7", 1, 0), ("8", 1, 1), ("9", 1, 2),
        ("4", 2, 0), ("5", 2, 1), ("6", 2, 2),
        ("1", 3, 0), ("2", 3, 1), ("3", 3, 2),
        ("0", 4, 1), ("C", 4, 0), ("=", 4, 2),
        ("+", 1, 3), ("-", 2, 3), ("*", 3, 3), ("/", 4, 3)
    ]
    
    for (text, row, col) in buttons:
        if text == "=":
            button = tk.Button(window, text=text, width=5, height=2, font=('Arial', 18), command=calculate)
        elif text == "C":
            button = tk.Button(window, text=text, width=5, height=2, font=('Arial', 18), command=clear)
        else:
            button = tk.Button(window, text=text, width=5, height=2, font=('Arial', 18), command=lambda val=text: click_button(val))
        button.grid(row=row, column=col)
    
    window.mainloop()

# ============================
# 190. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number = random.randint(1, 100)
    attempts = 0
    print("Welcome to the Number Guessing Game!")
    
    while True:
        guess = int(input("Guess a number between 1 and 100: "))
        attempts += 1
        
        if guess < number:
            print("Too low!")
        elif guess > number:
            print("Too high!")
        else:
            print(f"Correct! You've guessed the number in {attempts} attempts.")
            break
# ============================
# 191. To-Do List
# ============================
def to_do_list():
    tasks = []
    
    while True:
        print("\n1. Add Task\n2. View Tasks\n3. Remove Task\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            task = input("Enter the task: ")
            tasks.append(task)
            print(f"Added task: {task}")
        elif choice == '2':
            if tasks:
                print("\nYour Tasks:")
                for idx, task in enumerate(tasks, start=1):
                    print(f"{idx}. {task}")
            else:
                print("No tasks found.")
        elif choice == '3':
            task_idx = int(input("Enter the task number to remove: ")) - 1
            if 0 <= task_idx < len(tasks):
                removed_task = tasks.pop(task_idx)
                print(f"Removed task: {removed_task}")
            else:
                print("Invalid task number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 192. Flashcard App
# ============================
def flashcard_app():
    flashcards = {
        "What is the capital of France?": "Paris",
        "Who wrote '1984'?": "George Orwell",
        "What is the square root of 16?": "4",
    }

    for question, answer in flashcards.items():
        print(question)
        user_answer = input("Your answer: ")
        if user_answer.lower() == answer.lower():
            print("Correct!")
        else:
            print(f"Wrong! The correct answer is {answer}.")

# ============================
# 193. Currency Converter (Static rates)
# ============================
def static_currency_converter():
    conversion_rates = {
        "USD": 1,
        "EUR": 0.85,
        "GBP": 0.75,
        "INR": 74.60,
    }

    base_currency = input("Enter the base currency (USD, EUR, GBP, INR): ").upper()
    target_currency = input("Enter the target currency: ").upper()
    amount = float(input("Enter the amount: "))
    
    if base_currency in conversion_rates and target_currency in conversion_rates:
        converted_amount = amount * (conversion_rates[target_currency] / conversion_rates[base_currency])
        print(f"{amount} {base_currency} = {converted_amount:.2f} {target_currency}")
    else:
        print("Invalid currency.")

# ============================
# 194. Simple Alarm Clock
# ============================
import time
from datetime import datetime

def simple_alarm_clock():
    alarm_time = input("Enter the time for the alarm (HH:MM format): ")
    while True:
        current_time = datetime.now().strftime("%H:%M")
        if current_time == alarm_time:
            print("ALARM! Time's up!")
            break
        time.sleep(60)

# ============================
# 195. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms in the Fibonacci sequence: "))
    a, b = 0, 1
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 196. Birthday Reminder
# ============================
def birthday_reminder():
    birthdays = {
        "Alice": "2000-05-10",
        "Bob": "1995-08-15",
        "Charlie": "2001-12-25",
    }
    
    today = datetime.now().strftime("%m-%d")
    
    for name, date in birthdays.items():
        if date[5:] == today:
            print(f"Today is {name}'s birthday!")

# ============================
# 197. Simple Web Scraper
# ============================
import requests
from bs4 import BeautifulSoup

def simple_web_scraper():
    url = input("Enter the URL of the webpage to scrape: ")
    response = requests.get(url)
    
    if response.status_code == 200:
        soup = BeautifulSoup(response.text, 'html.parser')
        titles = soup.find_all('h1')
        for title in titles:
            print(title.get_text())
    else:
        print("Failed to retrieve the webpage.")

# ============================
# 198. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter an email address: ")
    regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    if re.match(regex, email):
        print(f"'{email}' is a valid email address.")
    else:
        print(f"'{email}' is not a valid email address.")

# ============================
# 199. Guess the Word Game
# ============================
import random

def guess_the_word():
    words = ["python", "java", "ruby", "javascript", "html"]
    word = random.choice(words)
    guessed_word = "_" * len(word)
    attempts = 6
    guessed_letters = []
    
    print("Welcome to Guess the Word!")
    
    while attempts > 0 and "_" in guessed_word:
        print(f"Word: {guessed_word}")
        print(f"Guessed letters: {', '.join(guessed_letters)}")
        print(f"Attempts left: {attempts}")
        
        guess = input("Guess a letter: ").lower()
        
        if guess in guessed_letters:
            print("You've already guessed that letter!")
            continue
        
        guessed_letters.append(guess)
        
        if guess in word:
            guessed_word = "".join([letter if letter == guess or guessed_word[idx] != "_" else "_" for idx, letter in enumerate(word)])
            print("Correct guess!")
        else:
            attempts -= 1
            print("Incorrect guess!")
    
    if "_" not in guessed_word:
        print(f"Congratulations! You guessed the word: {word}")
    # ============================
# 61. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter your email address: ")
    # Regular expression for validating an email
    regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    
    if re.match(regex, email):
        print(f"{email} is a valid email address.")
    else:
        print(f"{email} is not a valid email address.")

# ============================
# 62. Unit Converter (Temperature)
# ============================
def temperature_converter():
    print("Choose the conversion:")
    print("1. Celsius to Fahrenheit")
    print("2. Fahrenheit to Celsius")
    choice = int(input("Enter choice (1 or 2): "))
    
    if choice == 1:
        celsius = float(input("Enter temperature in Celsius: "))
        fahrenheit = (celsius * 9/5) + 32
        print(f"{celsius}°C is equal to {fahrenheit}°F.")
    elif choice == 2:
        fahrenheit = float(input("Enter temperature in Fahrenheit: "))
        celsius = (fahrenheit - 32) * 5/9
        print(f"{fahrenheit}°F is equal to {celsius}°C.")
    else:
        print("Invalid choice.")

# ============================
# 63. Roman to Integer Converter
# ============================
def roman_to_integer():
    roman = input("Enter a Roman numeral: ").upper()
    roman_dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
    total = 0
    prev_value = 0
    
    for char in reversed(roman):
        value = roman_dict.get(char, 0)
        if value < prev_value:
            total -= value
        else:
            total += value
        prev_value = value
    
    print(f"The integer value of {roman} is {total}.")

# ============================
# 64. Simple Interest Calculator
# ============================
def simple_interest():
    principal = float(input("Enter the principal amount: "))
    rate = float(input("Enter the rate of interest: "))
    time = float(input("Enter the time period in years: "))
    
    interest = (principal * rate * time) / 100
    print(f"The simple interest is: {interest}")
    total_amount = principal + interest
    print(f"The total amount after interest is: {total_amount}")

# ============================
# 65. Countdown Timer (with Custom Message)
# ============================
import time

def countdown_timer_custom_message():
    count = int(input("Enter countdown time in seconds: "))
    message = input("Enter a custom message for the countdown: ")
    
    while count >= 0:
        mins, secs = divmod(count, 60)
        timeformat = '{:02d}:{:02d}'.format(mins, secs)
        print(timeformat, end='\r')
        time.sleep(1)
        count -= 1
    
    print(f"Time's up! {message}")

# ============================
# 66. String to Pig Latin Converter
# ============================
def pig_latin_converter():
    sentence = input("Enter a sentence: ").split()
    pig_latin_sentence = []
    
    for word in sentence:
        first_letter = word[0].lower()
        if first_letter in 'aeiou':
            pig_latin_word = word + 'way'
        else:
            pig_latin_word = word[1:] + first_letter + 'ay'
        pig_latin_sentence.append(pig_latin_word.lower())
    
    print(f"Pig Latin version: {' '.join(pig_latin_sentence)}")

# ============================
# 67. Multiplication Table Generator
# ============================
def multiplication_table():
    number = int(input("Enter a number to generate its multiplication table: "))
    for i in range(1, 11):
        print(f"{number} x {i} = {number * i}")

# ============================
# 68. Magic 8 Ball
# ============================
import random

def magic_8_ball():
    responses = [
        "Yes", "No", "Maybe", "Ask again later", "Definitely not", "Yes, but not right now", 
        "The future is unclear", "I don't know", "Certainly", "Not a chance"
    ]
    question = input("Ask a yes or no question: ")
    print(f"Magic 8 Ball says: {random.choice(responses)}")

# ============================
# 69. Vowel Counter
# ============================
def vowel_counter():
    string = input("Enter a string: ")
    vowels = "aeiouAEIOU"
    count = sum(1 for char in string if char in vowels)
    print(f"The number of vowels in the string is: {count}")

# ============================
# 70. Loan EMI Calculator
# ============================
def loan_emi_calculator():
    principal = float(input("Enter the loan amount: "))
    rate = float(input("Enter the rate of interest (annual): ")) / 100 / 12
    months = int(input("Enter the number of months to pay: "))
    
    emi = (principal * rate * (1 + rate) ** months) / ((1 + rate) ** months - 1)
    print(f"Your monthly EMI is: {emi:.2f}")

# ============================
# 71. Contact Book System
# ============================
def contact_book():
    contacts = {}
    
    def add_contact():
        name = input("Enter name: ")
        phone = input("Enter phone number: ")
        contacts[name] = phone
        print(f"Contact {name} added.")
    
    def view_contacts():
        if contacts:
            for name, phone in contacts.items():
                print(f"Name: {name}, Phone: {phone}")
        else:
            print("No contacts available.")
    
    while True:
        print("1. Add Contact")
        print("2. View Contacts")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_contact()
        elif choice == 2:
            view_contacts()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")

# ============================
# 72. Task Tracker
# ============================
def task_tracker():
    tasks = []
    
    def add_task():
        task = input("Enter task: ")
        tasks.append(task)
        print(f"Task '{task}' added.")
    
    def view_tasks():
        if tasks:
            print("Your tasks:")
            for task in tasks:
                print(f"- {task}")
        else:
            print("No tasks available.")
    
    while True:
        print("1. Add Task")
        print("2. View Tasks")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_task()
        elif choice == 2:
            view_tasks()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")

# ============================
# 73. Birthday Reminder
# ============================
def birthday_reminder():
    birthdays = {}
    
    def add_birthday():
        name = input("Enter the name: ")
        date = input("Enter the birthday (DD/MM/YYYY): ")
        birthdays[name] = date
        print(f"Birthday for {name} added.")
    
    def view_birthdays():
        if birthdays:
            for name, date in birthdays.items():
                print(f"{name}: {date}")
        else:
            print("No birthdays available.")
    
    while True:
        print("1. Add Birthday")
        print("2. View Birthdays")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_birthday()
        elif choice == 2:
            view_birthdays()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")

# ============================
# 74. Palindrome Checker
# ============================
def palindrome_checker():
    string = input("Enter a string: ").lower()
    if string == string[::-1]:
        print(f"{string} is a palindrome.")
    else:
        print(f"{string} is not a palindrome.")

# ============================
# 75. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number = random.randint(1, 100)
    attempts = 0
    
    while True:
        guess = int(input("Guess the number between 1 and 100: "))
        attempts += 1
        if guess < number:
            print("Too low. Try again.")
        elif guess > number:
            print("Too high. Try again.")
        else:
            print(f"Congratulations! You guessed the number in {attempts} attempts.")
            break

# ============================
# 76. Tip Calculator
# ============================
def tip_calculator():
    amount = float(input("Enter the total amount: "))
    tip_percentage = float(input("Enter the tip percentage: "))
    tip = (amount * tip_percentage) / 100
    total_amount = amount + tip
    print(f"The tip is: {tip:.2f}")
    print(f"The total amount after tip is: {total_amount:.2f}")

# ============================
# 77. Loan Amortization Calculator
# ============================
def loan_amortization():
    principal = float(input("Enter loan amount: "))
    rate = float(input("Enter annual interest rate (in %): ")) / 100 / 12
    months = int(input("Enter number of months: "))
    
    emi = (principal * rate * (1 + rate) ** months) / ((1 + rate) ** months - 1)
    
    print(f"Your EMI is: {emi:.2f}")
    
    print("Amortization Schedule:")
    for month in range(1, months + 1):
        principal_payment = emi - (principal * rate)
        interest_payment = principal * rate
        principal -= principal_payment
        print(f"Month {month}: Interest = {interest_payment:.2f}, Principal = {principal_payment:.2f}, Remaining Principal = {principal:.2f}")

# ============================
# 78. Countdown Timer (Interactive)
# ============================
import time

def interactive_countdown_timer():
    seconds = int(input("Enter the number of seconds: "))
    
    for i in range(seconds, 0, -1):
        print(i, end="\r")
        time.sleep(1)
    
    print("Time's up!")

# ============================
# 79. Password Strength Checker
# ============================
import re

def password_strength_checker():
    password = input("Enter your password: ")
    
    # Check if password meets the criteria
    if len(password) < 8:
        print("Password too short! It must be at least 8 characters.")
    elif not re.search("[a-z]", password):
        print("Password must contain at least one lowercase letter.")
    elif not re.search("[A-Z]", password):
        print("Password must contain at least one uppercase letter.")
    elif not re.search("[0-9]", password):
        print("Password must contain at least one number.")
    elif not re.search("[!@#$%^&*(),.?\":{}|<>]", password):
        print("Password must contain at least one special character.")
    else:
        print("Password is strong.")

# ============================
# 80. Basic To-Do List
# ============================
def todo_list():
    todos = []
    
    def add_todo():
        todo = input("Enter a to-do item: ")
        todos.append(todo)
        print(f"'{todo}' added to the to-do list.")
    
    def view_todos():
        if todos:
            print("Your To-Do List:")
            for idx, todo in enumerate(todos, start=1):
                print(f"{idx}. {todo}")
        else:
            print("No to-do items.")
    
    while True:
        print("1. Add To-Do")
        print("2. View To-Dos")
        print("3. Exit")
        choice = int(input("Enter your choice: "))
        
        if choice == 1:
            add_todo()
        elif choice == 2:
            view_todos()
        elif choice == 3:
            break
        else:
            print("Invalid choice. Please try again.")
# ============================
# 81. Simple Calculator
# ============================
def simple_calculator():
    print("Welcome to the Simple Calculator!")
    while True:
        print("\nSelect operation:")
        print("1. Add")
        print("2. Subtract")
        print("3. Multiply")
        print("4. Divide")
        print("5. Exit")
        
        choice = input("Enter choice(1/2/3/4/5): ")
        
        if choice == '5':
            print("Exiting the calculator. Goodbye!")
            break
            
        num1 = float(input("Enter first number: "))
        num2 = float(input("Enter second number: "))
        
        if choice == '1':
            print(f"{num1} + {num2} = {num1 + num2}")
        elif choice == '2':
            print(f"{num1} - {num2} = {num1 - num2}")
        elif choice == '3':
            print(f"{num1} * {num2} = {num1 * num2}")
        elif choice == '4':
            if num2 != 0:
                print(f"{num1} / {num2} = {num1 / num2}")
            else:
                print("Cannot divide by zero!")
        else:
            print("Invalid input, please try again.")

# ============================
# 82. Currency Converter
# ============================
def currency_converter():
    print("Welcome to the Currency Converter!")
    conversion_rates = {
        "USD": 1,
        "EUR": 0.85,
        "INR": 75.00,
        "GBP": 0.74,
        "JPY": 110.30
    }
    
    base_currency = input("Enter the base currency (USD, EUR, INR, GBP, JPY): ").upper()
    if base_currency not in conversion_rates:
        print("Invalid currency.")
        return
    
    amount = float(input(f"Enter amount in {base_currency}: "))
    target_currency = input("Enter the target currency (USD, EUR, INR, GBP, JPY): ").upper()
    if target_currency not in conversion_rates:
        print("Invalid target currency.")
        return
    
    conversion_rate = conversion_rates[target_currency] / conversion_rates[base_currency]
    converted_amount = amount * conversion_rate
    print(f"{amount} {base_currency} = {converted_amount:.2f} {target_currency}")

# ============================
# 83. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birth_date = input("Enter your birthdate (DD/MM/YYYY): ")
    birth_date = datetime.strptime(birth_date, "%d/%m/%Y")
    today = datetime.today()
    
    age = today.year - birth_date.year
    if today.month < birth_date.month or (today.month == birth_date.month and today.day < birth_date.day):
        age -= 1
    
    print(f"Your age is: {age} years.")

# ============================
# 84. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter your email: ")
    if re.match(r"[^@]+@[^@]+\.[^@]+", email):
        print("Valid email address.")
    else:
        print("Invalid email address.")

# ============================
# 85. Dice Roller Simulation
# ============================
import random

def dice_roller():
    print("Welcome to the Dice Roller Simulator!")
    while True:
        roll = input("Roll the dice (y/n): ").lower()
        if roll == 'y':
            dice_roll = random.randint(1, 6)
            print(f"You rolled a {dice_roll}")
        elif roll == 'n':
            print("Exiting the Dice Roller. Goodbye!")
            break
        else:
            print("Invalid input. Please enter 'y' or 'n'.")

# ============================
# 86. Tic-Tac-Toe Game
# ============================
def tic_tac_toe():
    board = [" " for _ in range(9)]
    current_player = "X"
    
    def print_board():
        print(f"{board[0]} | {board[1]} | {board[2]}")
        print("--+---+--")
        print(f"{board[3]} | {board[4]} | {board[5]}")
        print("--+---+--")
        print(f"{board[6]} | {board[7]} | {board[8]}")
    
    def check_winner():
        for i in range(0, 9, 3):
            if board[i] == board[i+1] == board[i+2] != " ":
                return True
        for i in range(3):
            if board[i] == board[i+3] == board[i+6] != " ":
                return True
        if board[0] == board[4] == board[8] != " ":
            return True
        if board[2] == board[4] == board[6] != " ":
            return True
        return False
    
    while " " in board:
        print_board()
        move = int(input(f"Player {current_player}, enter your move (1-9): ")) - 1
        if board[move] == " ":
            board[move] = current_player
            if check_winner():
                print_board()
                print(f"Player {current_player} wins!")
                break
            current_player = "O" if current_player == "X" else "X"
        else:
            print("Invalid move, try again.")
    else:
        print("It's a draw!")
        print_board()

# ============================
# 87. Simple Stopwatch
# ============================
import time

def stopwatch():
    print("Welcome to the Stopwatch!")
    input("Press Enter to start...")
    start_time = time.time()
    
    while True:
        input("Press Enter to stop...")
        end_time = time.time()
        elapsed_time = round(end_time - start_time, 2)
        print(f"Elapsed time: {elapsed_time} seconds")
        break

# ============================
# 88. Weather Information Fetcher
# ============================
import requests

def weather_info():
    api_key = "YOUR_API_KEY"  # Replace with your OpenWeatherMap API key
    city = input("Enter city name: ")
    url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    
    response = requests.get(url)
    data = response.json()
    
    if data["cod"] == "404":
        print("City not found!")
    else:
        main = data["main"]
        temperature = main["temp"]
        humidity = main["humidity"]
        description = data["weather"][0]["description"]
        print(f"Temperature: {temperature}°C")
        print(f"Humidity: {humidity}%")
        print(f"Weather: {description}")

# ============================
# 89. Countdown Timer (Fixed Time)
# ============================
def countdown_timer_fixed():
    print("Enter time for countdown (in seconds): ")
    seconds = int(input())
    while seconds >= 0:
        minutes, sec = divmod(seconds, 60)
        print(f"{minutes:02}:{sec:02}", end="\r")
        time.sleep(1)
        seconds -= 1
    print("Time's up!")

# ============================
# 90. Contact Info Search
# ============================
def contact_info_search():
    contacts = {
        "John": "1234567890",
        "Alice": "0987654321",
        "Bob": "1122334455",
    }
    
    name = input("Enter contact name: ")
    if name in contacts:
        print(f"Contact information for {name}: {contacts[name]}")
    else:
        print("Contact not found.")

# ============================
# 91. To-Do List Application
# ============================
def todo_list():
    todos = []
    
    while True:
        print("\nTo-Do List:")
        print("1. Add Task")
        print("2. View Tasks")
        print("3. Remove Task")
        print("4. Exit")
        
        choice = input("Choose an option: ")
        
        if choice == '1':
            task = input("Enter the task: ")
            todos.append(task)
        elif choice == '2':
            if todos:
                print("\nYour Tasks:")
                for i, task in enumerate(todos, start=1):
                    print(f"{i}. {task}")
            else:
                print("No tasks available.")
        elif choice == '3':
            if todos:
                task_num = int(input(f"Enter task number to remove (1-{len(todos)}): "))
                if 1 <= task_num <= len(todos):
                    removed_task = todos.pop(task_num - 1)
                    print(f"Removed task: {removed_task}")
                else:
                    print("Invalid task number.")
            else:
                print("No tasks to remove.")
        elif choice == '4':
            print("Exiting To-Do List. Goodbye!")
            break
        else:
            print("Invalid option, try again.")

# ============================
# 92. Palindrome Checker
# ============================
def palindrome_checker():
    word = input("Enter a word: ").lower()
    if word == word[::-1]:
        print(f"{word} is a palindrome!")
    else:
        print(f"{word} is not a palindrome.")

# ============================
# 93. Fibonacci Sequence
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms in the Fibonacci sequence: "))
    a, b = 0, 1
    print(f"Fibonacci sequence with {n} terms:")
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 94. Number Guessing Game
# ============================
import random

def number_guessing_game():
    print("Welcome to the Number Guessing Game!")
    number = random.randint(1, 100)
    attempts = 0
    
    while True:
        guess = int(input("Guess a number between 1 and 100: "))
        attempts += 1
        
        if guess < number:
            print("Too low! Try again.")
        elif guess > number:
            print("Too high! Try again.")
        else:
            print(f"Correct! The number was {number}. You guessed it in {attempts} attempts.")
            break

# ============================
# 95. Prime Number Checker
# ============================
def prime_number_checker():
    num = int(input("Enter a number: "))
    if num < 2:
        print(f"{num} is not a prime number.")
        return
    
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            print(f"{num} is not a prime number.")
            return
    
    print(f"{num} is a prime number.")

# ============================
# 96. Simple Interest Calculator
# ============================
def simple_interest_calculator():
    principal = float(input("Enter the principal amount: "))
    rate = float(input("Enter the rate of interest: "))
    time = float(input("Enter the time period (in years): "))
    
    interest = (principal * rate * time) / 100
    total_amount = principal + interest
    
    print(f"Simple Interest: {interest}")
    print(f"Total Amount: {total_amount}")

# ============================
# 97. Number Counter
# ============================
def number_counter():
    count = int(input("Enter a number to count up to: "))
    
    for i in range(1, count + 1):
        print(i, end=" ")
    print()

# ============================
# 98. Temperature Converter
# ============================
def temperature_converter():
    print("1. Celsius to Fahrenheit")
    print("2. Fahrenheit to Celsius")
    
    choice = input("Choose conversion type (1 or 2): ")
    
    if choice == '1':
        celsius = float(input("Enter temperature in Celsius: "))
        fahrenheit = (celsius * 9/5) + 32
        print(f"{celsius}°C = {fahrenheit}°F")
    elif choice == '2':
        fahrenheit = float(input("Enter temperature in Fahrenheit: "))
        celsius = (fahrenheit - 32) * 5/9
        print(f"{fahrenheit}°F = {celsius}°C")
    else:
        print("Invalid choice.")

# ============================
# 99. Multiplication Table
# ============================
def multiplication_table():
    num = int(input("Enter a number to display its multiplication table: "))
    print(f"Multiplication table for {num}:")
    for i in range(1, 11):
        print(f"{num} x {i} = {num * i}")

# ============================
# 100. Basic Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\nContact Book:")
        print("1. Add Contact")
        print("2. View Contacts")
        print("3. Search Contact")
        print("4. Exit")
        
        choice = input("Choose an option: ")
        
        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact for {name} added.")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts available.")
        elif choice == '3':
            name = input("Enter name to search: ")
            if name in contacts:
                print(f"{name}: {contacts[name]}")
            else:
                print("Contact not found.")
        elif choice == '4':
            print("Exiting the Contact Book. Goodbye!")
            break
        else:
            print("Invalid option, try again.")
# ============================
# 101. Dice Rolling Simulator
# ============================
import random

def dice_rolling_simulator():
    print("Welcome to the Dice Rolling Simulator!")
    while True:
        input("Press Enter to roll the dice...")
        roll = random.randint(1, 6)
        print(f"You rolled a {roll}!")
        again = input("Do you want to roll again? (y/n): ")
        if again.lower() != 'y':
            print("Thanks for playing!")
            break

# ============================
# 102. Password Strength Checker
# ============================
import re

def password_strength_checker():
    password = input("Enter a password: ")
    
    if len(password) < 8:
        print("Password too short!")
    elif not re.search("[A-Z]", password):
        print("Password must contain at least one uppercase letter.")
    elif not re.search("[a-z]", password):
        print("Password must contain at least one lowercase letter.")
    elif not re.search("[0-9]", password):
        print("Password must contain at least one number.")
    elif not re.search("[!@#$%^&*(),.?\":{}|<>]", password):
        print("Password must contain at least one special character.")
    else:
        print("Password is strong!")

# ============================
# 103. Calendar Generator
# ============================
import calendar

def calendar_generator():
    year = int(input("Enter the year: "))
    month = int(input("Enter the month: "))
    print(calendar.month(year, month))

# ============================
# 104. Binary to Decimal Converter
# ============================
def binary_to_decimal():
    binary = input("Enter a binary number: ")
    decimal = int(binary, 2)
    print(f"The decimal equivalent of {binary} is {decimal}.")

# ============================
# 105. Decimal to Binary Converter
# ============================
def decimal_to_binary():
    decimal = int(input("Enter a decimal number: "))
    binary = bin(decimal)[2:]
    print(f"The binary equivalent of {decimal} is {binary}.")

# ============================
# 106. Tic-Tac-Toe Game
# ============================
def print_board(board):
    print("\n")
    for row in board:
        print(" | ".join(row))
        print("-" * 5)

def check_winner(board):
    # Check rows, columns, and diagonals
    for i in range(3):
        if board[i][0] == board[i][1] == board[i][2] != ' ':
            return True
        if board[0][i] == board[1][i] == board[2][i] != ' ':
            return True
    if board[0][0] == board[1][1] == board[2][2] != ' ':
        return True
    if board[0][2] == board[1][1] == board[2][0] != ' ':
        return True
    return False

def tic_tac_toe():
    board = [[' ' for _ in range(3)] for _ in range(3)]
    current_player = 'X'
    
    while True:
        print_board(board)
        row = int(input(f"Player {current_player}, enter the row (0, 1, or 2): "))
        col = int(input(f"Player {current_player}, enter the column (0, 1, or 2): "))
        
        if board[row][col] == ' ':
            board[row][col] = current_player
        else:
            print("Cell already taken. Try again.")
            continue
        
        if check_winner(board):
            print_board(board)
            print(f"Player {current_player} wins!")
            break
        
        current_player = 'O' if current_player == 'X' else 'X'

# ============================
# 107. Countdown Timer
# ============================
import time

def countdown_timer():
    seconds = int(input("Enter time in seconds: "))
    
    while seconds > 0:
        mins, secs = divmod(seconds, 60)
        time_format = '{:02d}:{:02d}'.format(mins, secs)
        print(time_format, end='\r')
        time.sleep(1)
        seconds -= 1
    
    print("Time's up!")

# ============================
# 108. Loan EMI Calculator
# ============================
def loan_emi_calculator():
    principal = float(input("Enter the loan amount: "))
    rate_of_interest = float(input("Enter the rate of interest per year (%): "))
    time_in_years = float(input("Enter the loan tenure in years: "))
    
    rate_of_interest /= (12 * 100)  # Monthly interest
    time_in_months = time_in_years * 12  # Convert years to months
    
    emi = (principal * rate_of_interest * (1 + rate_of_interest) ** time_in_months) / ((1 + rate_of_interest) ** time_in_months - 1)
    print(f"Your monthly EMI is: {emi:.2f}")

# ============================
# 109. Leap Year Checker
# ============================
def leap_year_checker():
    year = int(input("Enter a year: "))
    if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
        print(f"{year} is a leap year.")
    else:
        print(f"{year} is not a leap year.")

# ============================
# 110. Rock, Paper, Scissors Game
# ============================
import random

def rock_paper_scissors():
    choices = ['rock', 'paper', 'scissors']
    while True:
        user_choice = input("Enter rock, paper, or scissors: ").lower()
        if user_choice not in choices:
            print("Invalid choice! Try again.")
            continue
        
        computer_choice = random.choice(choices)
        print(f"Computer chose: {computer_choice}")
        
        if user_choice == computer_choice:
            print("It's a tie!")
        elif (user_choice == 'rock' and computer_choice == 'scissors') or (user_choice == 'paper' and computer_choice == 'rock') or (user_choice == 'scissors' and computer_choice == 'paper'):
            print("You win!")
        else:
            print("You lose!")
        
        play_again = input("Do you want to play again? (y/n): ")
        if play_again.lower() != 'y':
            break

# ============================
# 111. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birth_date = input("Enter your birth date (YYYY-MM-DD): ")
    birth_date = datetime.strptime(birth_date, "%Y-%m-%d")
    today = datetime.today()
    age = today.year - birth_date.year - ((today.month, today.day) < (birth_date.month, birth_date.day))
    print(f"Your age is: {age} years")

# ============================
# 112. Simple Alarm Clock
# ============================
import time
import winsound

def alarm_clock():
    alarm_time = input("Enter the time for the alarm (HH:MM): ")
    while True:
        current_time = time.strftime("%H:%M")
        if current_time == alarm_time:
            print("Time's up! Wake up!")
            winsound.Beep(1000, 1000)  # Beep sound
            break
        time.sleep(60)  # Wait for one minute

# ============================
# 113. Currency Converter
# ============================
def currency_converter():
    amount = float(input("Enter amount in USD: "))
    currency_rate = 74.57  # Example: USD to INR conversion rate
    converted_amount = amount * currency_rate
    print(f"{amount} USD is equal to {converted_amount} INR")

# ============================
# 114. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms in the Fibonacci sequence: "))
    a, b = 0, 1
    print("Fibonacci Sequence:")
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 115. Simple Interest Calculator
# ============================
def simple_interest_calculator():
    principal = float(input("Enter the principal amount: "))
    rate = float(input("Enter the rate of interest (%): "))
    time = float(input("Enter the time (in years): "))
    interest = (principal * rate * time) / 100
    print(f"Simple interest: {interest}")

# ============================
# 116. Hangman Game
# ============================
import random

def hangman():
    word_list = ['python', 'java', 'ruby', 'javascript']
    word = random.choice(word_list)
    guessed_word = ['_'] * len(word)
    attempts = 6

    print("Welcome to Hangman!")
    while attempts > 0:
        print(" ".join(guessed_word))
        guess = input(f"You have {attempts} attempts left. Enter a letter: ").lower()
        
        if guess in word:
            for i in range(len(word)):
                if word[i] == guess:
                    guessed_word[i] = guess
            print("Good guess!")
        else:
            attempts -= 1
            print("Wrong guess!")
        
        if '_' not in guessed_word:
            print(f"Congratulations, you guessed the word {word}!")
            break
    else:
        print(f"Game over! The word was {word}.")

# ============================
# 117. To-Do List Application
# ============================
def todo_list():
    tasks = []
    
    while True:
        print("\nTo-Do List Application:")
        print("1. Add task")
        print("2. View tasks")
        print("3. Delete task")
        print("4. Exit")
        choice = input("Enter your choice: ")

        if choice == '1':
            task = input("Enter task description: ")
            tasks.append(task)
            print(f"Task '{task}' added.")
        elif choice == '2':
            if tasks:
                print("Your tasks:")
                for idx, task in enumerate(tasks, 1):
                    print(f"{idx}. {task}")
            else:
                print("No tasks yet.")
        elif choice == '3':
            task_number = int(input("Enter task number to delete: "))
            if 1 <= task_number <= len(tasks):
                removed_task = tasks.pop(task_number - 1)
                print(f"Task '{removed_task}' deleted.")
            else:
                print("Invalid task number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 118. Binary Search Algorithm
# ============================
def binary_search(arr, target):
    low, high = 0, len(arr) - 1
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            low = mid + 1
        else:
            high = mid - 1
    return -1

def binary_search_program():
    arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
    target = int(input("Enter the number to search: "))
    result = binary_search(arr, target)
    
    if result != -1:
        print(f"Number found at index {result}.")
    else:
        print("Number not found.")

# ============================
# 119. Prime Number Checker
# ============================
def prime_number_checker():
    number = int(input("Enter a number: "))
    
    if number < 2:
        print(f"{number} is not a prime number.")
        return
    
    for i in range(2, int(number**0.5) + 1):
        if number % i == 0:
            print(f"{number} is not a prime number.")
            return
    print(f"{number} is a prime number.")

# ============================
# 120. Matrix Multiplication
# ============================
def matrix_multiplication():
    rows_a = int(input("Enter number of rows for Matrix A: "))
    cols_a = int(input("Enter number of columns for Matrix A: "))
    matrix_a = []
    print("Enter elements of Matrix A:")
    for _ in range(rows_a):
        matrix_a.append([int(x) for x in input().split()])

    rows_b = int(input("Enter number of rows for Matrix B: "))
    cols_b = int(input("Enter number of columns for Matrix B: "))
    if cols_a != rows_b:
        print("Matrix multiplication not possible!")
        return
    
    matrix_b = []
    print("Enter elements of Matrix B:")
    for _ in range(rows_b):
        matrix_b.append([int(x) for x in input().split()])

    result = [[0 for _ in range(cols_b)] for _ in range(rows_a)]

    for i in range(rows_a):
        for j in range(cols_b):
            for k in range(cols_a):
                result[i][j] += matrix_a[i][k] * matrix_b[k][j]
    
    print("Resulting Matrix:")
    for row in result:
        print(" ".join(map(str, row)))

# ============================
# 121. Email Slicer
# ============================
def email_slicer():
    email = input("Enter your email: ")
    username, domain = email.split('@')
    print(f"Your username is: {username}")
    print(f"Your domain is: {domain}")

# ============================
# 122. Countdown Timer
# ============================
import time

def countdown_timer():
    t = int(input("Enter the time for countdown (in seconds): "))
    while t:
        mins, secs = divmod(t, 60)
        timeformat = '{:02d}:{:02d}'.format(mins, secs)
        print(timeformat, end='\r')
        time.sleep(1)
        t -= 1
    print("Time's up!")

# ============================
# 123. Password Strength Checker
# ============================
import re

def password_strength_checker():
    password = input("Enter your password: ")
    if len(password) < 8:
        print("Password is too short!")
    elif not re.search("[A-Z]", password):
        print("Password must contain at least one uppercase letter.")
    elif not re.search("[0-9]", password):
        print("Password must contain at least one digit.")
    elif not re.search("[@#$%^&+=]", password):
        print("Password must contain at least one special character.")
    else:
        print("Password is strong!")

# ============================
# 124. Random Joke Generator
# ============================
import requests

def random_joke_generator():
    response = requests.get("https://official-joke-api.appspot.com/random_joke")
    joke = response.json()
    print(f"Here's a joke: {joke['setup']}")
    print(f"{joke['punchline']}")

# ============================
# 125. Contact Book
# ============================
def contact_book():
    contacts = {}
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Search Contact\n4. Exit")
        choice = input("Enter your choice: ")

        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact {name} added.")
        elif choice == '2':
            if contacts:
                for name, phone in contacts.items():
                    print(f"Name: {name}, Phone: {phone}")
            else:
                print("No contacts in the book.")
        elif choice == '3':
            name = input("Enter name to search: ")
            if name in contacts:
                print(f"Phone number of {name}: {contacts[name]}")
            else:
                print("Contact not found.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 126. Basic Calculator with GUI
# ============================
import tkinter as tk

def basic_calculator_gui():
    def click(button_text):
        current = entry.get()
        entry.delete(0, tk.END)
        entry.insert(tk.END, current + button_text)

    def clear():
        entry.delete(0, tk.END)

    def calculate():
        try:
            result = eval(entry.get())
            entry.delete(0, tk.END)
            entry.insert(tk.END, result)
        except:
            entry.delete(0, tk.END)
            entry.insert(tk.END, "Error")

    root = tk.Tk()
    root.title("Basic Calculator")

    entry = tk.Entry(root, width=20, font=("Arial", 24), borderwidth=2, relief="solid")
    entry.grid(row=0, column=0, columnspan=4)

    buttons = [
        ('7', 1, 0), ('8', 1, 1), ('9', 1, 2), ('/', 1, 3),
        ('4', 2, 0), ('5', 2, 1), ('6', 2, 2), ('*', 2, 3),
        ('1', 3, 0), ('2', 3, 1), ('3', 3, 2), ('-', 3, 3),
        ('0', 4, 0), ('.', 4, 1), ('+', 4, 2), ('=', 4, 3)
    ]

    for (text, row, col) in buttons:
        button = tk.Button(root, text=text, font=("Arial", 18), width=5, height=2, command=lambda text=text: click(text) if text != '=' else calculate())
        button.grid(row=row, column=col)

    clear_button = tk.Button(root, text="C", font=("Arial", 18), width=5, height=2, command=clear)
    clear_button.grid(row=5, column=0, columnspan=2)

    root.mainloop()

# ============================
# 127. Simple Chatbot
# ============================
def simple_chatbot():
    responses = {
        "hello": "Hi there! How can I help you?",
        "how are you": "I'm doing great, thanks for asking!",
        "bye": "Goodbye! Have a great day!",
        "default": "I'm sorry, I didn't understand that."
    }
    
    print("Chatbot: Hello! Type 'bye' to exit.")
    while True:
        user_input = input("You: ").lower()
        if user_input == 'bye':
            print("Chatbot: Goodbye!")
            break
        else:
            print(f"Chatbot: {responses.get(user_input, responses['default'])}")

# ============================
# 128. Word Count in a Text
# ============================
def word_count():
    text = input("Enter a sentence: ")
    words = text.split()
    print(f"Word count: {len(words)}")

# ============================
# 129. Simple Voting System
# ============================
def voting_system():
    candidates = ["Alice", "Bob", "Charlie"]
    votes = {candidate: 0 for candidate in candidates}
    
    while True:
        print("\nCandidates:")
        for idx, candidate in enumerate(candidates, 1):
            print(f"{idx}. {candidate}")
        
        choice = int(input("Enter the number of the candidate you want to vote for (0 to exit): "))
        if choice == 0:
            break
        elif 1 <= choice <= len(candidates):
            votes[candidates[choice - 1]] += 1
        else:
            print("Invalid choice!")
    
    print("\nVoting results:")
    for candidate, vote in votes.items():
        print(f"{candidate}: {vote} votes")

# ============================
# 130. Guess the Number Game
# ============================
import random

def guess_the_number():
    number = random.randint(1, 100)
    attempts = 0
    
    print("Welcome to 'Guess the Number' game!")
    while True:
        guess = int(input("Guess the number (between 1 and 100): "))
        attempts += 1
        
        if guess < number:
            print("Too low! Try again.")
        elif guess > number:
            print("Too high! Try again.")
        else:
            print(f"Congratulations! You guessed the number {number} in {attempts} attempts.")
            break
# ============================
# 131. To-Do List Application
# ============================
def todo_list():
    tasks = []
    while True:
        print("\n1. Add Task\n2. View Tasks\n3. Remove Task\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            task = input("Enter the task: ")
            tasks.append(task)
            print(f"Task '{task}' added.")
        elif choice == '2':
            if tasks:
                print("\nYour Tasks:")
                for idx, task in enumerate(tasks, 1):
                    print(f"{idx}. {task}")
            else:
                print("No tasks found.")
        elif choice == '3':
            if tasks:
                task_num = int(input("Enter task number to remove: "))
                if 1 <= task_num <= len(tasks):
                    removed_task = tasks.pop(task_num - 1)
                    print(f"Task '{removed_task}' removed.")
                else:
                    print("Invalid task number.")
            else:
                print("No tasks to remove.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 132. Currency Converter
# ============================
import requests

def currency_converter():
    print("Welcome to the currency converter!")
    base_currency = input("Enter the base currency (e.g., USD): ")
    target_currency = input("Enter the target currency (e.g., EUR): ")
    amount = float(input("Enter the amount: "))
    
    url = f"https://api.exchangerate-api.com/v4/latest/{base_currency}"
    response = requests.get(url).json()
    
    if target_currency in response['rates']:
        converted_amount = amount * response['rates'][target_currency]
        print(f"{amount} {base_currency} is equal to {converted_amount} {target_currency}.")
    else:
        print("Invalid currency code.")

# ============================
# 133. Simple Alarm Clock
# ============================
import time
import winsound

def alarm_clock():
    alarm_time = input("Enter the time for the alarm (HH:MM:SS): ")
    print("Waiting for alarm...")
    while True:
        current_time = time.strftime("%H:%M:%S")
        if current_time == alarm_time:
            print("Time's up! Alarm ringing...")
            winsound.Beep(1000, 1000)
            break
        time.sleep(1)

# ============================
# 134. Birthday Reminder
# ============================
from datetime import datetime

def birthday_reminder():
    birthdays = {}
    
    while True:
        print("\n1. Add Birthday\n2. View Birthdays\n3. Check Today's Birthdays\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter name: ")
            date_str = input("Enter birthday (YYYY-MM-DD): ")
            date = datetime.strptime(date_str, "%Y-%m-%d")
            birthdays[name] = date
            print(f"Birthday for {name} added.")
        elif choice == '2':
            if birthdays:
                print("\nBirthdays List:")
                for name, date in birthdays.items():
                    print(f"{name}: {date.strftime('%Y-%m-%d')}")
            else:
                print("No birthdays saved.")
        elif choice == '3':
            today = datetime.today()
            print("\nToday's Birthdays:")
            for name, date in birthdays.items():
                if date.month == today.month and date.day == today.day:
                    print(f"{name}: {date.strftime('%Y-%m-%d')}")
            else:
                print("No birthdays today.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 135. Flashcard Quiz App
# ============================
def flashcard_quiz():
    flashcards = {
        "Python": "A high-level programming language",
        "HTML": "Standard markup language for web pages",
        "CSS": "Style sheet language used for web page styling"
    }
    
    print("Welcome to the Flashcard Quiz App!")
    
    for term, definition in flashcards.items():
        print(f"Term: {term}")
        input("Press Enter to see the definition...")
        print(f"Definition: {definition}")
        print("------------")

# ============================
# 136. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birthdate_str = input("Enter your birthdate (YYYY-MM-DD): ")
    birthdate = datetime.strptime(birthdate_str, "%Y-%m-%d")
    today = datetime.today()
    
    age = today.year - birthdate.year
    if today.month < birthdate.month or (today.month == birthdate.month and today.day < birthdate.day):
        age -= 1
    print(f"You are {age} years old.")

# ============================
# 137. Random Number Generator
# ============================
import random

def random_number_generator():
    start = int(input("Enter the starting number: "))
    end = int(input("Enter the ending number: "))
    
    random_number = random.randint(start, end)
    print(f"The random number between {start} and {end} is: {random_number}")

# ============================
# 138. Simple Tic-Tac-Toe Game
# ============================
def print_board(board):
    print("\n")
    print(" | ".join(board[0:3]))
    print("---------")
    print(" | ".join(board[3:6]))
    print("---------")
    print(" | ".join(board[6:9]))
    print("\n")

def tic_tac_toe():
    board = [' ' for _ in range(9)]
    current_player = 'X'
    
    print("Welcome to Tic-Tac-Toe!")
    
    for i in range(9):
        print_board(board)
        position = int(input(f"Player {current_player}, choose a position (1-9): ")) - 1
        if board[position] == ' ':
            board[position] = current_player
            if (board[0] == board[1] == board[2] or
                board[3] == board[4] == board[5] or
                board[6] == board[7] == board[8] or
                board[0] == board[3] == board[6] or
                board[1] == board[4] == board[7] or
                board[2] == board[5] == board[8] or
                board[0] == board[4] == board[8] or
                board[2] == board[4] == board[6]):
                print_board(board)
                print(f"Player {current_player} wins!")
                return
            current_player = 'O' if current_player == 'X' else 'X'
        else:
            print("Position already taken! Try again.")
    
    print_board(board)
    print("It's a tie!")

# ============================
# 139. Simple Dice Roller
# ============================
import random

def dice_roller():
    roll = input("Roll the dice? (yes/no): ").lower()
    
    while roll == "yes":
        dice = random.randint(1, 6)
        print(f"You rolled a {dice}")
        roll = input("Roll again? (yes/no): ").lower()
    
    print("Goodbye!")

# ============================
# 140. Countdown Timer with Sound
# ============================
import time
import winsound

def countdown_with_sound():
    t = int(input("Enter the time for countdown (in seconds): "))
    while t:
        mins, secs = divmod(t, 60)
        timeformat = '{:02d}:{:02d}'.format(mins, secs)
        print(timeformat, end='\r')
        time.sleep(1)
        t -= 1
    print("Time's up!")
    winsound.Beep(1000, 1000)

# ============================
# 141. Weather App
# ============================
import requests

def weather_app():
    city = input("Enter city name: ")
    api_key = "your_api_key_here"
    base_url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    
    response = requests.get(base_url).json()
    
    if response['cod'] == 200:
        main = response['main']
        wind = response['wind']
        weather_desc = response['weather'][0]['description']
        temperature = main['temp']
        humidity = main['humidity']
        wind_speed = wind['speed']
        
        print(f"Weather in {city}:")
        print(f"Description: {weather_desc.capitalize()}")
        print(f"Temperature: {temperature}°C")
        print(f"Humidity: {humidity}%")
        print(f"Wind Speed: {wind_speed} m/s")
    else:
        print("City not found.")

# ============================
# 142. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number_to_guess = random.randint(1, 100)
    attempts = 0
    
    print("Welcome to the Number Guessing Game!")
    print("Guess the number between 1 and 100.")
    
    while True:
        guess = int(input("Enter your guess: "))
        attempts += 1
        
        if guess < number_to_guess:
            print("Too low! Try again.")
        elif guess > number_to_guess:
            print("Too high! Try again.")
        else:
            print(f"Correct! You guessed the number in {attempts} attempts.")
            break

# ============================
# 143. Mad Libs Game
# ============================
def mad_libs():
    print("Welcome to Mad Libs Game!")
    adjective = input("Enter an adjective: ")
    noun = input("Enter a noun: ")
    verb = input("Enter a verb: ")
    adverb = input("Enter an adverb: ")
    
    print(f"\nHere is your story:\n")
    print(f"The {adjective} {noun} decided to {verb} {adverb}.")

# ============================
# 144. Simple Chatbot
# ============================
def chatbot():
    print("Hello! I am a chatbot. How can I assist you today?")
    
    while True:
        user_input = input("You: ")
        if user_input.lower() in ['hi', 'hello']:
            print("Chatbot: Hello! How can I help you today?")
        elif 'bye' in user_input.lower():
            print("Chatbot: Goodbye! Have a nice day.")
            break
        else:
            print(f"Chatbot: You said {user_input}. Sorry, I don't understand.")

# ============================
# 145. Countdown Timer with Logging
# ============================
import time

def countdown_timer_with_logging():
    time_in_sec = int(input("Enter countdown time in seconds: "))
    print("Countdown started...")
    while time_in_sec > 0:
        mins, secs = divmod(time_in_sec, 60)
        print(f"{mins:02d}:{secs:02d}", end="\r")
        time.sleep(1)
        time_in_sec -= 1
    print("Time's up!")
    log_time()

def log_time():
    with open("time_log.txt", "a") as file:
        file.write("Countdown completed at: " + time.strftime("%Y-%m-%d %H:%M:%S") + "\n")
    print("Time logged to time_log.txt.")

# ============================
# 146. Email Slicer
# ============================
def email_slicer():
    email = input("Enter your email address: ")
    username, domain = email.split('@')
    print(f"Username: {username}")
    print(f"Domain: {domain}")

# ============================
# 147. Simple Calculator with GUI
# ============================
import tkinter as tk

def calculator_gui():
    def add():
        result_var.set(float(entry1.get()) + float(entry2.get()))
    
    def subtract():
        result_var.set(float(entry1.get()) - float(entry2.get()))
    
    def multiply():
        result_var.set(float(entry1.get()) * float(entry2.get()))
    
    def divide():
        try:
            result_var.set(float(entry1.get()) / float(entry2.get()))
        except ZeroDivisionError:
            result_var.set("Error! Div by 0")
    
    window = tk.Tk()
    window.title("Simple Calculator")
    
    entry1 = tk.Entry(window)
    entry1.grid(row=0, column=0)
    
    entry2 = tk.Entry(window)
    entry2.grid(row=0, column=1)
    
    result_var = tk.StringVar()
    result_label = tk.Label(window, textvariable=result_var)
    result_label.grid(row=1, column=0, columnspan=2)
    
    add_button = tk.Button(window, text="Add", command=add)
    add_button.grid(row=2, column=0)
    
    subtract_button = tk.Button(window, text="Subtract", command=subtract)
    subtract_button.grid(row=2, column=1)
    
    multiply_button = tk.Button(window, text="Multiply", command=multiply)
    multiply_button.grid(row=3, column=0)
    
    divide_button = tk.Button(window, text="Divide", command=divide)
    divide_button.grid(row=3, column=1)
    
    window.mainloop()

# ============================
# 148. Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Remove Contact\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter contact name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact for {name} added.")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts found.")
        elif choice == '3':
            name = input("Enter the name of the contact to remove: ")
            if name in contacts:
                del contacts[name]
                print(f"Contact for {name} removed.")
            else:
                print(f"No contact found for {name}.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 149. File Renamer
# ============================
import os

def file_renamer():
    path = input("Enter directory path: ")
    prefix = input("Enter prefix to add to files: ")
    
    files = os.listdir(path)
    
    for file in files:
        if os.path.isfile(os.path.join(path, file)):
            new_name = prefix + file
            os.rename(os.path.join(path, file), os.path.join(path, new_name))
            print(f"Renamed: {file} to {new_name}")
    
    print("File renaming completed.")

# ============================
# 150. Image to Grayscale Converter
# ============================
from PIL import Image

def image_to_grayscale():
    image_path = input("Enter image file path: ")
    image = Image.open(image_path)
    grayscale_image = image.convert("L")
    grayscale_image.save("grayscale_image.png")
    grayscale_image.show()
    print("Image converted to grayscale and saved as 'grayscale_image.png'.")

# ============================
# 151. Simple Stopwatch
# ============================
import time

def simple_stopwatch():
    input("Press Enter to start the stopwatch...")
    start_time = time.time()
    
    input("Press Enter to stop the stopwatch...")
    end_time = time.time()
    
    elapsed_time = end_time - start_time
    print(f"Elapsed time: {elapsed_time:.2f} seconds")

# ============================
# 152. Dice Roller
# ============================
import random

def dice_roller():
    roll_again = "yes"
    
    while roll_again.lower() == "yes":
        print(f"Rolling the dice... You got: {random.randint(1, 6)}")
        roll_again = input("Do you want to roll again? (yes/no): ")

# ============================
# 153. Prime Number Checker
# ============================
def prime_number_checker():
    number = int(input("Enter a number to check if it is prime: "))
    
    if number > 1:
        for i in range(2, int(number / 2) + 1):
            if (number % i) == 0:
                print(f"{number} is not a prime number.")
                break
        else:
            print(f"{number} is a prime number.")
    else:
        print(f"{number} is not a prime number.")

# ============================
# 154. Palindrome Checker
# ============================
def palindrome_checker():
    string = input("Enter a string to check if it's a palindrome: ")
    if string == string[::-1]:
        print(f"{string} is a palindrome.")
    else:
        print(f"{string} is not a palindrome.")

# ============================
# 155. To-Do List
# ============================
def todo_list():
    tasks = []
    
    while True:
        print("\n1. Add Task\n2. View Tasks\n3. Remove Task\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            task = input("Enter task: ")
            tasks.append(task)
            print(f"Task '{task}' added.")
        elif choice == '2':
            if tasks:
                print("\nYour To-Do List:")
                for index, task in enumerate(tasks, 1):
                    print(f"{index}. {task}")
            else:
                print("No tasks in the list.")
        elif choice == '3':
            task_index = int(input("Enter task number to remove: ")) - 1
            if 0 <= task_index < len(tasks):
                removed_task = tasks.pop(task_index)
                print(f"Task '{removed_task}' removed.")
            else:
                print("Invalid task number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 156. Tic-Tac-Toe Game
# ============================
def tic_tac_toe():
    board = [' ' for _ in range(9)]
    current_player = "X"
    
    def print_board():
        print(f"{board[0]} | {board[1]} | {board[2]}")
        print("--+---+--")
        print(f"{board[3]} | {board[4]} | {board[5]}")
        print("--+---+--")
        print(f"{board[6]} | {board[7]} | {board[8]}")
    
    def check_winner():
        win_conditions = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
        for condition in win_conditions:
            if board[condition[0]] == board[condition[1]] == board[condition[2]] != ' ':
                return True
        return False
    
    while ' ' in board:
        print_board()
        move = int(input(f"Player {current_player}, enter your move (1-9): ")) - 1
        if board[move] == ' ':
            board[move] = current_player
            if check_winner():
                print_board()
                print(f"Player {current_player} wins!")
                break
            current_player = "O" if current_player == "X" else "X"
        else:
            print("Invalid move, try again.")
    
    if ' ' not in board:
        print_board()
        print("It's a draw!")

# ============================
# 157. Simple Alarm Clock
# ============================
import datetime
import time

def alarm_clock():
    alarm_time = input("Enter the alarm time in HH:MM format: ")
    alarm_hour, alarm_minute = map(int, alarm_time.split(":"))
    
    while True:
        current_time = datetime.datetime.now().strftime("%H:%M")
        print(f"Current time: {current_time}", end="\r")
        if current_time == f"{alarm_hour:02d}:{alarm_minute:02d}":
            print("\nAlarm ringing! Time's up!")
            break
        time.sleep(60)

# ============================
# 158. Currency Converter
# ============================
def currency_converter():
    amount = float(input("Enter the amount in USD: "))
    currency = input("Enter the target currency (e.g., EUR, INR, GBP): ").upper()
    
    exchange_rates = {
        "EUR": 0.85,  # Example rate
        "INR": 75.0,  # Example rate
        "GBP": 0.74   # Example rate
    }
    
    if currency in exchange_rates:
        converted_amount = amount * exchange_rates[currency]
        print(f"{amount} USD is equal to {converted_amount} {currency}.")
    else:
        print("Currency not supported.")

# ============================
# 159. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms: "))
    a, b = 0, 1
    print("Fibonacci Sequence:")
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 160. Binary Search
# ============================
def binary_search():
    arr = [int(x) for x in input("Enter sorted numbers separated by space: ").split()]
    target = int(input("Enter the number to search: "))
    
    low, high = 0, len(arr) - 1
    found = False
    
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] == target:
            found = True
            break
        elif arr[mid] < target:
            low = mid + 1
        else:
            high = mid - 1
    
    if found:
        print(f"Number {target} found at index {mid}.")
    else:
        print(f"Number {target} not found in the list.")

# ============================
# 161. Countdown Timer
# ============================
import time

def countdown_timer():
    total_seconds = int(input("Enter countdown time in seconds: "))
    while total_seconds > 0:
        minutes, seconds = divmod(total_seconds, 60)
        print(f"Time left: {minutes:02d}:{seconds:02d}", end="\r")
        time.sleep(1)
        total_seconds -= 1
    print("Time's up!")

# ============================
# 162. Weather App (API based)
# ============================
import requests

def weather_app():
    city = input("Enter the city name: ")
    api_key = "your_api_key_here"  # Replace with your own API key
    url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}"
    
    response = requests.get(url)
    data = response.json()
    
    if response.status_code == 200:
        temp = data['main']['temp'] - 273.15  # Convert from Kelvin to Celsius
        weather = data['weather'][0]['description']
        print(f"Weather in {city}: {weather}")
        print(f"Temperature: {temp:.2f}°C")
    else:
        print(f"City {city} not found!")

# ============================
# 163. Simple Calculator
# ============================
def simple_calculator():
    num1 = float(input("Enter first number: "))
    operator = input("Enter operator (+, -, *, /): ")
    num2 = float(input("Enter second number: "))
    
    if operator == "+":
        result = num1 + num2
    elif operator == "-":
        result = num1 - num2
    elif operator == "*":
        result = num1 * num2
    elif operator == "/":
        result = num1 / num2
    else:
        print("Invalid operator!")
        return
    
    print(f"Result: {result}")

# ============================
# 164. Simple Chatbot
# ============================
def simple_chatbot():
    print("Hello! I'm a simple chatbot. Type 'exit' to end the conversation.")
    while True:
        user_input = input("You: ")
        
        if user_input.lower() == "exit":
            print("Goodbye!")
            break
        elif "how are you" in user_input.lower():
            print("Chatbot: I'm doing well, thank you!")
        elif "hello" in user_input.lower():
            print("Chatbot: Hello! How can I assist you today?")
        else:
            print("Chatbot: Sorry, I didn't understand that.")

# ============================
# 165. Text-based Adventure Game
# ============================
def adventure_game():
    print("Welcome to the Adventure Game!")
    print("You are in a forest. There are two paths ahead.")
    print("1. Take the left path")
    print("2. Take the right path")
    
    choice = input("Which path do you choose (1/2): ")
    
    if choice == "1":
        print("You took the left path and encountered a dragon!")
        action = input("Do you fight or run? (fight/run): ")
        if action == "fight":
            print("You bravely fought the dragon and won! You are a hero!")
        else:
            print("You ran away and safely returned to the forest entrance.")
    elif choice == "2":
        print("You took the right path and found a treasure chest!")
        action = input("Do you open it or leave it? (open/leave): ")
        if action == "open":
            print("You found a pile of gold! You're rich!")
        else:
            print("You left the treasure chest and continued walking.")
    else:
        print("Invalid choice. Please choose 1 or 2.")

# ============================
# 166. Basic Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Search Contact\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Contact {name} added.")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts in the list.")
        elif choice == '3':
            name = input("Enter the name to search: ")
            if name in contacts:
                print(f"Contact found: {name}: {contacts[name]}")
            else:
                print(f"No contact found with the name {name}.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 167. Simple Password Generator
# ============================
import random
import string

def password_generator():
    length = int(input("Enter the length of the password: "))
    characters = string.ascii_letters + string.digits + string.punctuation
    password = ''.join(random.choice(characters) for _ in range(length))
    print(f"Generated password: {password}")

# ============================
# 168. Basic Quiz Game
# ============================
def quiz_game():
    questions = [
        {"question": "What is the capital of France?", "answer": "Paris"},
        {"question": "What is 2 + 2?", "answer": "4"},
        {"question": "Who is the author of '1984'?", "answer": "George Orwell"},
    ]
    
    score = 0
    for q in questions:
        answer = input(q["question"] + " ")
        if answer.lower() == q["answer"].lower():
            score += 1
    
    print(f"You got {score}/{len(questions)} correct!")

# ============================
# 169. BMI Calculator
# ============================
def bmi_calculator():
    height = float(input("Enter your height in meters: "))
    weight = float(input("Enter your weight in kilograms: "))
    
    bmi = weight / (height ** 2)
    print(f"Your BMI is: {bmi:.2f}")
    
    if bmi < 18.5:
        print("You are underweight.")
    elif 18.5 <= bmi < 24.9:
        print("You have a normal weight.")
    elif 25 <= bmi < 29.9:
        print("You are overweight.")
    else:
        print("You are obese.")

# ============================
# 170. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number = random.randint(1, 100)
    attempts = 0
    print("Welcome to the Number Guessing Game!")
    print("I have chosen a number between 1 and 100. Try to guess it.")
    
    while True:
        guess = int(input("Enter your guess: "))
        attempts += 1
        
        if guess < number:
            print("Too low!")
        elif guess > number:
            print("Too high!")
        else:
            print(f"Congratulations! You've guessed the number in {attempts} attempts.")
            break

# ============================
# 171. Tic-Tac-Toe Game
# ============================
def print_board(board):
    for row in board:
        print(" | ".join(row))
        print("-" * 5)

def tic_tac_toe():
    board = [[" " for _ in range(3)] for _ in range(3)]
    current_player = "X"
    winner = None
    
    while winner is None:
        print_board(board)
        row = int(input(f"Player {current_player}, enter row (0, 1, 2): "))
        col = int(input(f"Player {current_player}, enter column (0, 1, 2): "))
        
        if board[row][col] == " ":
            board[row][col] = current_player
            winner = check_winner(board)
            current_player = "O" if current_player == "X" else "X"
        else:
            print("Cell already taken! Try again.")
    
    print_board(board)
    print(f"Player {winner} wins!")

def check_winner(board):
    for row in board:
        if row[0] == row[1] == row[2] and row[0] != " ":
            return row[0]
    
    for col in range(3):
        if board[0][col] == board[1][col] == board[2][col] and board[0][col] != " ":
            return board[0][col]
    
    if board[0][0] == board[1][1] == board[2][2] and board[0][0] != " ":
        return board[0][0]
    
    if board[0][2] == board[1][1] == board[2][0] and board[0][2] != " ":
        return board[0][2]
    
    return None

# ============================
# 172. Flashcard App
# ============================
def flashcard_app():
    flashcards = {
        "What is the capital of France?": "Paris",
        "What is 5 + 5?": "10",
        "What color is the sky?": "Blue",
    }
    
    for question, answer in flashcards.items():
        print(f"Question: {question}")
        input("Press Enter to see the answer.")
        print(f"Answer: {answer}")
        print("-" * 30)

# ============================
# 173. Simple Alarm Clock
# ============================
import time
import winsound

def alarm_clock():
    alarm_time = input("Enter alarm time (HH:MM AM/PM): ")
    alarm_hour, alarm_minute = map(int, alarm_time[:-6].split(":"))
    if alarm_time[-2:].upper() == "PM" and alarm_hour != 12:
        alarm_hour += 12
    if alarm_time[-2:].upper() == "AM" and alarm_hour == 12:
        alarm_hour = 0
    
    print("Waiting for alarm...")
    
    while True:
        current_time = time.localtime()
        if current_time.tm_hour == alarm_hour and current_time.tm_min == alarm_minute:
            print("Alarm Time!")
            winsound.Beep(1000, 1000)  # Beep sound
            break
        time.sleep(30)

# ============================
# 174. Age Calculator
# ============================
from datetime import datetime

def age_calculator():
    birth_date = input("Enter your birth date (YYYY-MM-DD): ")
    birth_date = datetime.strptime(birth_date, "%Y-%m-%d")
    today = datetime.today()
    
    age = today.year - birth_date.year
    if today.month < birth_date.month or (today.month == birth_date.month and today.day < birth_date.day):
        age -= 1
    
    print(f"You are {age} years old.")

# ============================
# 175. To-Do List App
# ============================
def todo_list():
    todos = []
    
    while True:
        print("\n1. Add Todo\n2. View Todos\n3. Remove Todo\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            todo = input("Enter a new todo: ")
            todos.append(todo)
            print(f"Todo '{todo}' added.")
        elif choice == '2':
            if todos:
                print("\nYour Todos:")
                for i, todo in enumerate(todos, 1):
                    print(f"{i}. {todo}")
            else:
                print("No todos found.")
        elif choice == '3':
            todo_num = int(input("Enter the number of the todo to remove: "))
            if 0 < todo_num <= len(todos):
                removed_todo = todos.pop(todo_num - 1)
                print(f"Removed todo: {removed_todo}")
            else:
                print("Invalid todo number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 176. Currency Converter
# ============================
def currency_converter():
    currencies = {
        "USD": 1,
        "EUR": 0.85,
        "GBP": 0.75,
        "INR": 74.85,
        "AUD": 1.35,
    }
    
    print("Available currencies: USD, EUR, GBP, INR, AUD")
    from_currency = input("Enter the currency to convert from: ").upper()
    to_currency = input("Enter the currency to convert to: ").upper()
    amount = float(input("Enter the amount: "))
    
    if from_currency in currencies and to_currency in currencies:
        converted_amount = amount * (currencies[to_currency] / currencies[from_currency])
        print(f"{amount} {from_currency} is equal to {converted_amount:.2f} {to_currency}.")
    else:
        print("Invalid currency.")

# ============================
# 177. Expense Tracker
# ============================
def expense_tracker():
    expenses = []
    
    while True:
        print("\n1. Add Expense\n2. View Expenses\n3. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            category = input("Enter the expense category: ")
            amount = float(input("Enter the expense amount: "))
            expenses.append({"category": category, "amount": amount})
            print(f"Added expense: {category} - {amount}")
        elif choice == '2':
            if expenses:
                print("\nYour Expenses:")
                total = 0
                for expense in expenses:
                    print(f"{expense['category']}: {expense['amount']}")
                    total += expense['amount']
                print(f"Total Expenses: {total}")
            else:
                print("No expenses recorded.")
        elif choice == '3':
            break
        else:
            print("Invalid choice!")

# ============================
# 178. Fibonacci Sequence
# ============================
def fibonacci_sequence(n):
    fib_sequence = [0, 1]
    while len(fib_sequence) < n:
        fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
    return fib_sequence

def print_fibonacci():
    n = int(input("Enter the number of terms: "))
    print(f"The first {n} terms of the Fibonacci sequence are:")
    print(fibonacci_sequence(n))

# ============================
# 179. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter your email: ")
    regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    
    if re.match(regex, email):
        print("Valid email!")
    else:
        print("Invalid email!")

# ============================
# 180. Prime Number Checker
# ============================
def prime_number_checker():
    number = int(input("Enter a number: "))
    if number < 2:
        print("Not a prime number.")
        return
    
    for i in range(2, int(number ** 0.5) + 1):
        if number % i == 0:
            print("Not a prime number.")
            return
    
    print("It's a prime number!")

# ============================
# 181. Weather App
# ============================
import requests

def weather_app():
    city = input("Enter the city name: ")
    api_key = "your_api_key_here"
    base_url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    response = requests.get(base_url)
    
    if response.status_code == 200:
        data = response.json()
        main_data = data["main"]
        weather_data = data["weather"][0]
        print(f"City: {city}")
        print(f"Temperature: {main_data['temp']}°C")
        print(f"Weather: {weather_data['description']}")
    else:
        print("City not found or invalid API key.")

# ============================
# 182. Countdown Timer
# ============================
import time

def countdown_timer():
    seconds = int(input("Enter time in seconds for countdown: "))
    
    while seconds >= 0:
        mins, secs = divmod(seconds, 60)
        time_format = f"{mins:02d}:{secs:02d}"
        print(time_format, end="\r")
        time.sleep(1)
        seconds -= 1
    
    print("Time's up!")

# ============================
# 183. Quiz Game
# ============================
def quiz_game():
    questions = {
        "What is the capital of USA?": "Washington D.C.",
        "Who developed Python?": "Guido van Rossum",
        "What is 2 + 2?": "4",
    }
    score = 0
    for question, correct_answer in questions.items():
        print(question)
        answer = input("Your answer: ")
        if answer.lower() == correct_answer.lower():
            score += 1
    
    print(f"Your score: {score}/{len(questions)}")

# ============================
# 184. Contact Book
# ============================
def contact_book():
    contacts = {}
    
    while True:
        print("\n1. Add Contact\n2. View Contacts\n3. Remove Contact\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            name = input("Enter name: ")
            phone = input("Enter phone number: ")
            contacts[name] = phone
            print(f"Added contact: {name} - {phone}")
        elif choice == '2':
            if contacts:
                print("\nYour Contacts:")
                for name, phone in contacts.items():
                    print(f"{name}: {phone}")
            else:
                print("No contacts found.")
        elif choice == '3':
            name = input("Enter the name of the contact to remove: ")
            if name in contacts:
                del contacts[name]
                print(f"Removed contact: {name}")
            else:
                print("Contact not found.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 185. Palindrome Checker
# ============================
def palindrome_checker():
    word = input("Enter a word: ")
    if word == word[::-1]:
        print(f"'{word}' is a palindrome!")
    else:
        print(f"'{word}' is not a palindrome.")

# ============================
# 186. Simple Chatbot
# ============================
def simple_chatbot():
    print("Hello, I am your chatbot. Type 'exit' to end the conversation.")
    while True:
        user_input = input("You: ")
        if user_input.lower() == 'exit':
            print("Goodbye!")
            break
        elif "hello" in user_input.lower():
            print("Chatbot: Hi there!")
        elif "how are you" in user_input.lower():
            print("Chatbot: I'm doing great, thank you!")
        else:
            print("Chatbot: I'm not sure how to respond to that.")

# ============================
# 187. Rock Paper Scissors
# ============================
import random

def rock_paper_scissors():
    choices = ["rock", "paper", "scissors"]
    user_choice = input("Enter rock, paper, or scissors: ").lower()
    if user_choice not in choices:
        print("Invalid choice.")
        return
    
    computer_choice = random.choice(choices)
    print(f"Computer chose: {computer_choice}")
    
    if user_choice == computer_choice:
        print("It's a tie!")
    elif (user_choice == "rock" and computer_choice == "scissors") or \
         (user_choice == "paper" and computer_choice == "rock") or \
         (user_choice == "scissors" and computer_choice == "paper"):
        print("You win!")
    else:
        print("You lose!")

# ============================
# 188. Currency Converter (Real-time rates)
# ============================
import requests

def real_time_currency_converter():
    base_currency = input("Enter the base currency (USD, EUR, etc.): ").upper()
    target_currency = input("Enter the target currency: ").upper()
    amount = float(input("Enter the amount: "))
    
    api_url = f"https://api.exchangerate-api.com/v4/latest/{base_currency}"
    response = requests.get(api_url)
    
    if response.status_code == 200:
        data = response.json()
        if target_currency in data['rates']:
            conversion_rate = data['rates'][target_currency]
            converted_amount = amount * conversion_rate
            print(f"{amount} {base_currency} = {converted_amount:.2f} {target_currency}")
        else:
            print("Target currency not found.")
    else:
        print("Error fetching exchange rates.")

# ============================
# 189. Simple Calculator (GUI)
# ============================
import tkinter as tk

def calculator_gui():
    def click_button(value):
        current = entry.get()
        entry.delete(0, tk.END)
        entry.insert(0, current + value)

    def clear():
        entry.delete(0, tk.END)

    def calculate():
        try:
            result = eval(entry.get())
            entry.delete(0, tk.END)
            entry.insert(0, result)
        except Exception as e:
            entry.delete(0, tk.END)
            entry.insert(0, "Error")

    window = tk.Tk()
    window.title("Calculator")
    
    entry = tk.Entry(window, width=20, font=('Arial', 20), bd=10, relief="solid", justify="right")
    entry.grid(row=0, column=0, columnspan=4)

    buttons = [
        ("7", 1, 0), ("8", 1, 1), ("9", 1, 2),
        ("4", 2, 0), ("5", 2, 1), ("6", 2, 2),
        ("1", 3, 0), ("2", 3, 1), ("3", 3, 2),
        ("0", 4, 1), ("C", 4, 0), ("=", 4, 2),
        ("+", 1, 3), ("-", 2, 3), ("*", 3, 3), ("/", 4, 3)
    ]
    
    for (text, row, col) in buttons:
        if text == "=":
            button = tk.Button(window, text=text, width=5, height=2, font=('Arial', 18), command=calculate)
        elif text == "C":
            button = tk.Button(window, text=text, width=5, height=2, font=('Arial', 18), command=clear)
        else:
            button = tk.Button(window, text=text, width=5, height=2, font=('Arial', 18), command=lambda val=text: click_button(val))
        button.grid(row=row, column=col)
    
    window.mainloop()

# ============================
# 190. Number Guessing Game
# ============================
import random

def number_guessing_game():
    number = random.randint(1, 100)
    attempts = 0
    print("Welcome to the Number Guessing Game!")
    
    while True:
        guess = int(input("Guess a number between 1 and 100: "))
        attempts += 1
        
        if guess < number:
            print("Too low!")
        elif guess > number:
            print("Too high!")
        else:
            print(f"Correct! You've guessed the number in {attempts} attempts.")
            break
# ============================
# 191. To-Do List
# ============================
def to_do_list():
    tasks = []
    
    while True:
        print("\n1. Add Task\n2. View Tasks\n3. Remove Task\n4. Exit")
        choice = input("Enter your choice: ")
        
        if choice == '1':
            task = input("Enter the task: ")
            tasks.append(task)
            print(f"Added task: {task}")
        elif choice == '2':
            if tasks:
                print("\nYour Tasks:")
                for idx, task in enumerate(tasks, start=1):
                    print(f"{idx}. {task}")
            else:
                print("No tasks found.")
        elif choice == '3':
            task_idx = int(input("Enter the task number to remove: ")) - 1
            if 0 <= task_idx < len(tasks):
                removed_task = tasks.pop(task_idx)
                print(f"Removed task: {removed_task}")
            else:
                print("Invalid task number.")
        elif choice == '4':
            break
        else:
            print("Invalid choice!")

# ============================
# 192. Flashcard App
# ============================
def flashcard_app():
    flashcards = {
        "What is the capital of France?": "Paris",
        "Who wrote '1984'?": "George Orwell",
        "What is the square root of 16?": "4",
    }

    for question, answer in flashcards.items():
        print(question)
        user_answer = input("Your answer: ")
        if user_answer.lower() == answer.lower():
            print("Correct!")
        else:
            print(f"Wrong! The correct answer is {answer}.")

# ============================
# 193. Currency Converter (Static rates)
# ============================
def static_currency_converter():
    conversion_rates = {
        "USD": 1,
        "EUR": 0.85,
        "GBP": 0.75,
        "INR": 74.60,
    }

    base_currency = input("Enter the base currency (USD, EUR, GBP, INR): ").upper()
    target_currency = input("Enter the target currency: ").upper()
    amount = float(input("Enter the amount: "))
    
    if base_currency in conversion_rates and target_currency in conversion_rates:
        converted_amount = amount * (conversion_rates[target_currency] / conversion_rates[base_currency])
        print(f"{amount} {base_currency} = {converted_amount:.2f} {target_currency}")
    else:
        print("Invalid currency.")

# ============================
# 194. Simple Alarm Clock
# ============================
import time
from datetime import datetime

def simple_alarm_clock():
    alarm_time = input("Enter the time for the alarm (HH:MM format): ")
    while True:
        current_time = datetime.now().strftime("%H:%M")
        if current_time == alarm_time:
            print("ALARM! Time's up!")
            break
        time.sleep(60)

# ============================
# 195. Fibonacci Sequence Generator
# ============================
def fibonacci_sequence():
    n = int(input("Enter the number of terms in the Fibonacci sequence: "))
    a, b = 0, 1
    for _ in range(n):
        print(a, end=" ")
        a, b = b, a + b
    print()

# ============================
# 196. Birthday Reminder
# ============================
def birthday_reminder():
    birthdays = {
        "Alice": "2000-05-10",
        "Bob": "1995-08-15",
        "Charlie": "2001-12-25",
    }
    
    today = datetime.now().strftime("%m-%d")
    
    for name, date in birthdays.items():
        if date[5:] == today:
            print(f"Today is {name}'s birthday!")

# ============================
# 197. Simple Web Scraper
# ============================
import requests
from bs4 import BeautifulSoup

def simple_web_scraper():
    url = input("Enter the URL of the webpage to scrape: ")
    response = requests.get(url)
    
    if response.status_code == 200:
        soup = BeautifulSoup(response.text, 'html.parser')
        titles = soup.find_all('h1')
        for title in titles:
            print(title.get_text())
    else:
        print("Failed to retrieve the webpage.")

# ============================
# 198. Email Validator
# ============================
import re

def email_validator():
    email = input("Enter an email address: ")
    regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    if re.match(regex, email):
        print(f"'{email}' is a valid email address.")
    else:
        print(f"'{email}' is not a valid email address.")

# ============================
# 199. Guess the Word Game
# ============================
import random

def guess_the_word():
    words = ["python", "java", "ruby", "javascript", "html"]
    word = random.choice(words)
    guessed_word = "_" * len(word)
    attempts = 6
    guessed_letters = []
    
    print("Welcome to Guess the Word!")
    
    while attempts > 0 and "_" in guessed_word:
        print(f"Word: {guessed_word}")
        print(f"Guessed letters: {', '.join(guessed_letters)}")
        print(f"Attempts left: {attempts}")
        
        guess = input("Guess a letter: ").lower()
        
        if guess in guessed_letters:
            print("You've already guessed that letter!")
            continue
        
        guessed_letters.append(guess)
        
        if guess in word:
            guessed_word = "".join([letter if letter == guess or guessed_word[idx] != "_" else "_" for idx, letter in enumerate(word)])
            print("Correct guess!")
        else:
            attempts -= 1
            print("Incorrect guess!")
    
    if "_" not in guessed_word:
        print(f"Congratulations! You guessed the word: {word}")
    else:
        print(f"Game over! The word was: {word}")

# ============================
# 200. Simple File Encryption
# ============================
def simple_file_encryption():
    key = int(input("Enter an encryption key (a number): "))
    filename = input("Enter the filename to encrypt: ")
    
    with open(filename, 'r') as file:
        data = file.read()
    
    encrypted_data = "".join([chr(ord(char) + key) for char in data])
    
    with open("encrypted_" + filename, 'w') as file:
        file.write(encrypted_data)
    
    print(f"File '{filename}' has been encrypted and saved as 'encrypted_{filename}'.")

:
        print(f"Game over! The word was: {word}")

# ============================
# 200. Simple File Encryption
# ============================
def simple_file_encryption():
    key = int(input("Enter an encryption key (a number): "))
    filename = input("Enter the filename to encrypt: ")
    
    with open(filename, 'r') as file:
        data = file.read()
    
    encrypted_data = "".join([chr(ord(char) + key) for char in data])
    
    with open("encrypted_" + filename, 'w') as file:
        file.write(encrypted_data)
    
    print(f"File '{filename}' has been encrypted and saved as 'encrypted_{filename}'.")

     
Python

NON PERFORMING LOAN OF FINANCE COMPANIES Q1 2081/82

Finance companies in Nepal are grappling with a surge in non-performing loans (NPLs). As of the first quarter of the current fiscal year, the average NPL ratio of finance companies has climbed to 9.34%, compared to 8.10% in the same period last year.

This increase is attributed to the prolonged slowdown in the domestic economy, which has hampered effective loan disbursement and recovery. Despite implementing various strategies to curb inactive loans, financial institutions have struggled to achieve significant results, leading to further growth in NPLs.

Among finance companies, Janaki Finance saw the steepest rise, with its NPL ratio surging by 17.04 percentage points to 34.64%. Samriddhi Finance’s NPLs also jumped by 18.68 percentage points to reach 23.47%. Similarly, NPLs of Guheshwori Merchant and Nepal Finance have exceeded 10%, while Manjushree Finance recorded the lowest ratio at 3.12%.

Nepal Rastra Bank mandates a maximum NPL threshold of 5%. Institutions exceeding this limit face restrictions on deposit collection, lending, branch expansion, employee remuneration hikes, and dividend distribution. Notably, seven listed finance companies currently exceed the 5% NPL limit.

SEE FULL REPORT

NPL Data Table

Non-Performing Loan (NPL) of Finance Companies

Company Name 1st Quarter 2081/82 1st Quarter 2080/81 Difference
Janaki Finance 34.64% 17.60% 17.04%
Samriddhi Finance 23.47% 4.79% 18.68%
Guheshowori Merchant Bank & Finance 13.56% 4.72% 8.84%
Nepal Finance 10.36% 11.75% -1.39%
Central Finance 8.71% 7.43% 1.28%
Reliance Finance 8.58% 4.96% 3.62%
Progressive Finance 7.47% 12.45% -4.98%
Multipurpose Finance 4.97% 1.22% 3.75%
Goodwill Finance 4.91% 3.97% 0.94%
Best Finance Company 3.98% 5.49% -1.51%
Pokhara Finance 3.85% 2.08% 1.77%
ICFC Finance 3.66% 3.23% 0.43%
Gurkhas Finance 3.21% 1.94% 1.27%
Shree Investment Finance 3.19% 1.20% 1.99%
Manjushree Finance 3.12% 2.85% 0.27%
Download Data

CHIMMEK LAGHUBITTA ANNOUNCE ITS Q1 2081/82 REPORT

Chhimek Laghubitta Bittiya Sanstha Limited (CBBL) has published its unaudited financial report for the first quarter of the current fiscal year, showing a slight increase in net profit compared to the same period last year. As of Ashoj’s end, the company has earned a net profit of NPR 23.74 crores, a 7.38% rise from NPR 22.11 crores in the same period of the previous fiscal year. Despite a decline in interest income, a significant 52.04% reduction in impairment charges contributed to the profit increase. During the review period, the company’s net interest income grew by 6.67%, although total operating income decreased by 3.10%. The distributable profit stands at NPR 1.90 billion, with a distributable earnings per share (EPS) of NPR 63.86. The company’s EPS rose by NPR 0.71 to reach NPR 31.91, while its net worth per share stands at NPR 256.99, and the price-to-earnings ratio is 31.50 times. With a paid-up capital of NPR 2.97 billion, CBBL maintains a reserve fund of NPR 4.67 billion. By the end of Ashoj, the company has mobilized NPR 38.86 billion in deposits and extended NPR 36.49 billion in loans.

SEE REPORT

Financial Data

Financial Data Table

Dimension Q1 – 081/082 Q1 – 080/081 Q4 – 080/081 Q3 – 080/081 Q2 – 080/081 Diff
Paid Up Capital1.17 Arab1.08 Arab1.17 Arab1.17 Arab1.08 Arab7.5
Reserve1.40 Arab92.34 Cr1.42 Arab1.25 Arab1.26 Arab52.03
Retained Earning31.81 Cr25.81 Cr28.11 Cr42.23 Cr40.39 Cr23.26
Deposit5.66 Arab4.29 Arab5.24 Arab5.41 Arab5.24 Arab31.76
Loan21.29 Arab17.17 Arab20.64 Arab19.49 Arab18.37 Arab24.05
Net Interest Income30.45 Cr14.91 Cr1.16 Arab59.23 Cr35.32 Cr104.22
Net Fee Commission Income5.24 Cr4.89 Cr25.80 Cr14.92 Cr10.67 Cr7.12
Operating Profit14.97 Cr7.87 Cr47.17 Cr27.25 Cr14.89 Cr90.32
Net Profit10.48 Cr5.51 Cr34.09 Cr19.08 Cr10.42 Cr90.32
Distributable Profit33.02 Cr4.29 Cr28.11 Cr29.01 Cr38.52 Cr668.8
EPS35.2920.3129.2521.8219.1273.76
Net Worth247.75208.97245.9243.29253.8818.56
NPL4.264.173.254.363.742.16
RWA11.9512.5311.312.1812.63-4.63
Total Assets23.62 Arab18.26 Arab22.22 Arab21.30 Arab20.27 Arab29.34
Total Liabilities20.74 Arab16.00 Arab19.35 Arab18.46 Arab17.52 Arab29.61
Cost of Fund8.819.979.589.929.85-11.63
Base Rate13.5314.3213.8413.7214.25-5.52
Interest Spread4.812.694.233.153.2978.81
CD Ratio385.59353.69369.78365.27355.489.02

STANDARD CHARTERED BANK ANNOUNCE ITS DIVIDENT

Standard Chartered Bank Limited (SCB) has called its 38th Annual General Meeting (AGM) to endorse the proposed dividend distribution from the profit of the last fiscal year.

Details of the AGM:

  • Date: Mangsir 25, 2081
  • Venue: Army Officers Club, Bhadrakali, Kathmandu
  • Time: 9:30 AM

Proposed Dividend:

  • 6.50% Bonus Shares
  • 19% Cash Dividend (including tax purposes)
    The dividend will be distributed based on the current paid-up capital.

Key Agendas of the AGM:

  1. Approval of Dividend Proposal:
    • To approve the distribution of bonus shares and cash dividends.
  2. Amendment of Articles of Association and Bylaws:
    • To authorize the Board of Directors to make necessary amendments.
  3. Appointment of Auditor:
    • To appoint an auditor for the upcoming fiscal year.
  4. Other general proposals.

Book Closure Information:

  • Book Closure Date: Mangsir 6, 2081 (for one day).
  • Eligibility for Shareholders:
    • Shareholders listed on NEPSE by Mangsir 5, 2081, will be eligible to attend the AGM and receive the proposed dividend.

Standard Chartered Bank Limited encourages its shareholders to actively participate in the AGM and provide valuable feedback on the bank’s future plans.

SUPERMAI HYDROPOWER ANNOUNCE AGM FOR 2081/82

Supermai Hydropower Limited (SMH) has announced its 10th Annual General Meeting (AGM), scheduled to take place on 28th Mangsir, 2081. The meeting will be held at Lisara Receptions, Naxal, Kathmandu, commencing at 4 PM.

Key Agendas of the AGM:

  1. Endorsement of Dividend:
    • A 12.63% dividend has been proposed for the fiscal year 2080/81.
    • 7% bonus shares, valued at Rs. 3.50 Crores.
    • 5.63% cash dividend (including tax), worth Rs. 2.81 Crores.
    • The proposal was approved in the 108th board meeting held on Bhadra 17.
  2. Review and Approval of Financial Statements:
    • Auditor’s Report for FY 2080/81.
    • Profit and Loss Statement, Financial Reports, and Cash Flow Reports.
  3. Appointment of Auditor:
    • Selection and appointment of an auditor for the fiscal year 2081/82.

Financial Overview:

  • Paid-up Capital: Rs. 50 Crores.

AGM NOTICE

error: Content is protected !!
Scroll to Top
MacroNepal
Verified by MonsterInsights