Skip to content
This is my space, where experience meets the will to start over. This is my space, where experience meets the will to start over.

The first step is knowing where you want to go.

  • Home
  • Coding Hub
    • Software & Project
      • Small Biz Ops – S.B.O.
        • SmallBizOps – Day 10/90
      • CRM/ERP
      • MyTracker
      • My Budget
    • Form Zero to “WoW”
      • JavaScript from Zero (Completed)
        • 2. Remove and Edit List Items
        • 3. Separate HTML and JavaScript, Use addEventListener and Conditional Logic
        • 4. Add Dynamic CSS Classes
        • 5. Save & Restore Your List with localStorage
        • 6 – Turn Your App into a Full To-Do List
      • Python from Zero (Completed)
        • 2. Lists & Loops
        • 3. Conditional Menus
        • 4. Edit & Remove Tasks (with closing: Python vs PHP and Large Data)
        • 5 – Save to File: Make Your Tasks Survive Restarts
        • 6 — Pythin from zero – Final Project Polishing: Numbering, Formatting, and Preparing for CSV
      • Rust – From Zero to “WoW” (Completed)
        • 1 – Setup and Project Structure in Rust
        • 2 – User input: validation and error handling
        • 3 – Rust from Zero to “WoW – BMI Calculation and Conditional Logic
        • 4 –Rust – Clear, Formatted Output
        • 5 – Rust – Final Thoughts: Precision as a Form of Respect
      • Go from Zero to “WoW” (Completed)
        • 1 – Why Go Is Perfect for a Personal Expense Tracker
        • 2 – Logging Expenses and Console Input
        • 3 – Go from Zero to “WoW” – Smart Filtering & Display Logic
        • 4 – Go – Saving Data to Local Files
        • 5 – Go – Final Project – Expense Tracker in Go
      • C++ from Zero to “WoW” (Completed)
        • 1 – Why C++ for file organization?
        • 2 – C++ – File Type Detection and Classification
        • 3 – C++ – Creating & Managing Subfolders
        • 4 – C++ – Safe File Movement and User Feedback
        • 5 – C++ – Order as Mental Clarity
      • Ubuntu – From Zero to “WoW” (Completed)
        • 2 – Ubuntu – The Desktop Environment and Essential Commands
        • 3 – Ubuntu – Managing Files, Folders, and Permissions
        • 4 – Ubuntu – Installing and Updating Software with APT and Snap
        • 5 – Ubuntu – Customizing the Desktop Environment
        • 6 – Ubuntu – Network and Device Configuration
        • 7 – Ubuntu – User Management & System Security — “The Cathedral of Permissions”
        • 8 – Ubuntu – The Talking Machine: Terminal & Bash Scripting
        • 9 – Ubuntu – Ubuntu as a Server or Development Environment
        • 10 – Ubuntu – Backup, Maintenance & Troubleshooting
    • Git Hub Repository
      • Small Biz Ops – S.B.O.
      • Mini ERP – PHP & MySQL
      • CleverCRM (Java, Spring Boot)
      • FraudWatch (Python, FastAPI + scikit-learn)
      • OnboardIQ – Smart Onboarding Portal (Flask + SQLite Demo)
    • ArchPilot
      • 1-Users & Roles, End-to-End (Architecture, Database, and Cross-Framework Code)
      • 2 – Client Registry (CRM) Across Frameworks
      • 3 – Project & Budget Tracker (ERP)
      • 4 – Approval Workflow Engine Multi-step routing, status tracking, escalation paths
      • 5 – Audit Trail & Versioning
    • Small Biz Ops – S.B.O.
  • Vivere in USA
  • P4Y
  • Testi poetici
    • 1 – Sospeso
    • 2 – Il bicchiere di vetro quieto
    • 3 – Quando l’amore inciampa
    • 4 – Ma chi siete davvero?
    • 5 – Above the Thread of Day
    • 6 – The Truth That Doesn’t Exist
    • 7 – All of You, I Miss
    • 8 – The Captain and the Ocean
    • 9 – Between Light and Mist
    • 10 – Il peso delle scelte
  • Contact
  • Admin
This is my space, where experience meets the will to start over.
This is my space, where experience meets the will to start over.

The first step is knowing where you want to go.

Coding – Step 10.4 – Edit & Remove Tasks (with closing: Python vs PHP and Large Data)

Posted on 17 Agosto 202517 Agosto 2025 By Francesco

In Step 10.3 we built a menu-driven To-Do list with options to add, view, and exit.
But a real list isn’t useful unless you can manage it: some tasks must be marked done ✅, others should be removed 🗑️.

In this lesson we extend the program with functions to:

  • mark a task as completed,
  • delete a task from the list.

You’ll learn how to:

  • work with indexes (numeric positions) in a list,
  • update values inside a list (modify a field),
  • remove elements using del or pop().

🎯 Goal

Extend the menu with:

  • [A] Add task
  • [V] View tasks
  • [M] Mark task as completed
  • [D] Delete task
  • [X] Exit

📝 Updated code

# todo_edit_remove.py

tasks = []  # Each task is a dict: {"text": "...", "done": False}

def show_menu():
    print("\n=== TO-DO MENU ===")
    print("[A] Add task")
    print("[V] View tasks")
    print("[M] Mark task as complete")
    print("[D] Delete task")
    print("[X] Exit")

def add_task():
    text = input("Write the new task: ").strip()
    if text:
        tasks.append({"text": text, "done": False})
        print(f"✅ '{text}' added to the list!")
    else:
        print("⚠️ You didn't write anything, task not added.")

def view_tasks():
    if not tasks:
        print("📭 No tasks available.")
        return
    print("\n📋 Your tasks:")
    for i, t in enumerate(tasks, start=1):
        status = "✅" if t["done"] else "⭕"
        print(f"{i}. {status} {t['text']}")

def mark_task():
    view_tasks()
    if not tasks:
        return
    try:
        num = int(input("Which number do you want to mark as complete? "))
        if 1 <= num <= len(tasks):
            tasks[num-1]["done"] = True
            print(f"🎉 '{tasks[num-1]['text']}' marked as complete!")
        else:
            print("❌ Invalid number.")
    except ValueError:
        print("⚠️ You must enter a number.")

def delete_task():
    view_tasks()
    if not tasks:
        return
    try:
        num = int(input("Which number do you want to delete? "))
        if 1 <= num <= len(tasks):
            removed = tasks.pop(num-1)
            print(f"🗑️ '{removed['text']}' removed from the list.")
        else:
            print("❌ Invalid number.")
    except ValueError:
        print("⚠️ You must enter a number.")

def main():
    print("Welcome to your To-Do List!")
    while True:
        show_menu()
        choice = input("Choose an option: ").strip().lower()

        if choice == "a":
            add_task()
        elif choice == "v":
            view_tasks()
        elif choice == "m":
            mark_task()
        elif choice == "d":
            delete_task()
        elif choice == "x":
            print("Goodbye! 👋")
            break
        else:
            print("❌ Invalid command, try again.")

if __name__ == "__main__":
    main()

🔍 How it works

  • tasks = [] → the list now stores dictionaries, each with text and done.
  • mark_task() → shows tasks, asks for a number, sets done = True.
  • delete_task() → shows tasks, asks for a number, removes with pop().
  • enumerate(..., start=1) numbers tasks for humans (1-based).
  • Invalid input is handled with try/except.

💡 Possible improvements

  • Add an option to unmark a task (undo “completed”).
  • Save tasks to a file (next step).
  • Add colors (e.g., with colorama).

🧪 Exercises

  1. Add an option to mark all tasks as completed.
  2. Change mark_task() to toggle state (completed ↔ not completed).
  3. Add a [C] Clear all command that empties the list after confirmation.

🚫 Common mistakes

  • Forgetting to check if the list is empty before asking for a number.
  • Not converting input to int, causing type errors.
  • Using wrong indexes (remember Python is 0-based, while we display from 1).

📌 Key takeaways

  • With indexes you can target and manage individual list items.
  • Dictionaries make each task’s state clear (text + completed).
  • We added essential features: mark as done and delete.

Closing – Python vs PHP and a first look at large data

After building a To-Do list in Python and a similar app in PHP, you might think they’re the same. Both handle lists, input/output, saving, and logic.
In reality, Python and PHP have different histories, goals, and usage contexts.


✅ Similarities

  • Both are interpreted languages.
  • Both can build interactive applications and manipulate data.
  • Both can be used for web and local scripts.

🚦 Key differences

AspectPythonPHP
Origin / philosophy1991, general-purpose scripting. Today: data science, ML, automation, backend.1995, dynamic web pages. Dominant in classic web (WordPress, Drupal).
Typical environmentDesktop, servers, Jupyter notebooks, APIs, automation.Web servers (Apache/Nginx). Most shared hostings support it by default.
Data handlingLibraries like Pandas and NumPy to analyze very large datasets in memory.Often paired with SQL databases (MySQL, PostgreSQL) to display dynamic website data.
CommunityData scientists, researchers, backend developers.Web developers, CMS maintainers, full-stack web.
DistributionScripts, CLI apps, APIs, microservices, machine learning.Web apps and CMS.

🤔 When to use Python vs PHP?

Choose Python if…

  • You need to analyze or process large amounts of data.
  • You’re into AI, machine learning, or automation.
  • You want a multi-purpose language beyond the web.

Choose PHP if…

  • You want to create/manage a dynamic website quickly.
  • You use CMSs like WordPress or Drupal.
  • You need to connect web interfaces to SQL databases for real users.

📦 First look at large-data work

Scenario: a CSV with 1 million sales rows.

Python → direct analysis with Pandas

import pandas as pd

df = pd.read_csv("vendite.csv")

print("Row count:", len(df))
print("Total sales:", df["totale"].sum())

df2025 = df[df["anno"] == 2025]
print("Rows for 2025:", len(df2025))

👉 In a few lines, Python loads and analyzes millions of records.


PHP → presentation via SQL database

<?php
$conn = new mysqli("localhost", "user", "password", "database");

$sql = "SELECT COUNT(*) as rows FROM vendite";
$res = $conn->query($sql)->fetch_assoc();
echo "Total rows: " . $res["rows"];

$sql = "SELECT SUM(totale) as total FROM vendite WHERE anno = 2025";
$res = $conn->query($sql)->fetch_assoc();
echo "Total sales 2025: " . $res["total"];
?>

👉 PHP doesn’t analyze in memory; it queries the database and presents results.


🔍 Two useful metaphors

  • Python is a scientific lab: it ingests data, transforms it, computes statistics, finds patterns.
  • PHP is a web storefront: it takes prepared data and shows it to users dynamically.

🧪 Reflection exercises

  1. Write a Python script to compute the average of a numeric field in a large CSV.
  2. Write a PHP script that shows the same aggregates, but from a MySQL database.
  3. Compare the experience: where do you need analysis, and where presentation?

📌 Final takeaways

  • Python and PHP aren’t competitors; they serve different purposes.
  • Python → analysis, automation, large data, AI.
  • PHP → dynamic web, user interfaces, CMS, databases.
  • Together they shine: Python processes data, PHP exposes it to users.
Post Views: 370

Condividi:

  • Condividi su Facebook (Si apre in una nuova finestra) Facebook
  • Condividi su X (Si apre in una nuova finestra) X
Coding Python Big DataDelete TasksEdit Taskso-Do AppPandasPython ListsPython vs PHPUser Input

Navigazione articoli

Previous post
Next post

Francesco

My name is Francesco Boschi, originally from Italy and currently based in the United States. For over twenty years, I’ve worked as a manager and consultant across diverse sectors — from education and cultural institutions to the food industry — developing skills in operational management, strategic consulting, and complex problem-solving. In recent years, I’ve combined this experience with a strong passion for software development, creating custom tools designed to simplify workflows and meet real business needs.

Relocating to the U.S. marks the beginning of a new chapter: a personal and professional decision driven by the desire to be close to my son and to embrace new challenges in a different environment. Today, my goal is to turn my experience into meaningful solutions, blending strategic vision with technical expertise to help people and organizations work more effectively.

I enjoy moving between different worlds, adapting tools and approaches to people and contexts. I bring leadership, flexibility, attention to detail, analytical thinking, and a strong problem-solving mindset — along with a deep curiosity to learn and grow. Above all, I believe in sharing: I’m always eager to offer my experience to support the growth of others.

Related Posts

Coding

Coding – ArchPilot – Step 2 – Client Registry (CRM) Across Frameworks

Posted on 20 Novembre 202520 Novembre 2025

ArchPilot – Step 2 extends the multi-framework ERP/CRM showcase with a shared Client Registry module (organizations, contacts, interactions), implemented consistently across Laravel, Django, Spring Boot, ASP.NET Core, Node.js/Express, and Drupal, all wired into the RBAC and audit layer from Step 1.

Condividi:

  • Condividi su Facebook (Si apre in una nuova finestra) Facebook
  • Condividi su X (Si apre in una nuova finestra) X
Read More
Go

Coding – Step 12.3 – Go from Zero to “WoW” – Smart Filtering & Display Logic

Posted on 7 Ottobre 20257 Ottobre 2025

Build a tiny but powerful Go CLI that loads items, filters them with composable predicates, and prints a clean table. You’ll learn how to model data, write reusable filter functions, chain conditions, sort and paginate results, and test everything with Go’s testing tools.

Condividi:

  • Condividi su Facebook (Si apre in una nuova finestra) Facebook
  • Condividi su X (Si apre in una nuova finestra) X
Read More
Coding

Coding – Step 6 – When a few minutes and the right tool are enough: a practical example with Pipedream and Telegram

Posted on 1 Luglio 202526 Luglio 2025

Those who know me know I don’t like to complicate things.Whenever possible, I prefer lean, fast, elegant solutions.You don’t always need to build complex software or monumental architectures — sometimes all it takes is a few lines of code, a bit of mental agility, and the right tools. 🔗 What…

Condividi:

  • Condividi su Facebook (Si apre in una nuova finestra) Facebook
  • Condividi su X (Si apre in una nuova finestra) X
Read More

Iscriviti alla nostra Newsletter

🤞 Let's keep in touch

We do not send spam! Read our Privacy policy for more information.

Controlla la tua casella di posta o la cartella spam per confermare la tua iscrizione

Cerca nel sito

©2026 This is my space, where experience meets the will to start over. | WordPress Theme by SuperbThemes