<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged pythonprojects</title>
<link>https://coderlegion.com/tag/pythonprojects</link>
<description>Powered by Question2Answer</description>
<item>
<title>Create a Simple To-Do List in Python – Stay Organized</title>
<link>https://coderlegion.com/5544/create-a-simple-to-do-list-in-python-stay-organized</link>
<description>&lt;p&gt;Staying organized is key for students, developers, and anyone managing tasks. In this tutorial, we’ll build a simple To-Do List in Python that allows you to add, view, and delete tasks directly from the console. It’s a perfect beginner-friendly project and a great way to practice Python programming.&lt;br&gt;
Prerequisites&lt;br&gt;
-Basic knowledge of Python&lt;br&gt;
-Python installed on your computer (or use Replit to run the code online)&lt;br&gt;
 Step 1: The Complete Code&lt;br&gt;
import datetime&lt;/p&gt;
&lt;h2 id=&quot;list-to-store-tasks&quot;&gt;List to store tasks&lt;/h2&gt;
&lt;p&gt;tasks = []&lt;/p&gt;
&lt;p&gt;def show_menu():&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;print(&quot;\n=== Student To-Do App ===&quot;)
print(&quot;1. Add a task&quot;)
print(&quot;2. Show all tasks&quot;)
print(&quot;3. Show today's tasks&quot;)
print(&quot;4. Delete a task&quot;)
print(&quot;5. Quit&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;def add_task():&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;title = input(&quot;Task name: &quot;)
priority = input(&quot;Priority (high/medium/low): &quot;).lower()
deadline = input(&quot;Deadline (YYYY-MM-DD, leave empty if none): &quot;)

if deadline:
    try:
        deadline = datetime.datetime.strptime(deadline, &quot;%Y-%m-%d&quot;).date()
    except ValueError:
        print(&quot; Wrong date format! Example: 2025-09-14&quot;)
        return
else:
    deadline = None

task = {&quot;title&quot;: title, &quot;priority&quot;: priority, &quot;deadline&quot;: deadline}
tasks.append(task)
print(f&quot; Task '{title}' added successfully!&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;def show_all_tasks():&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if not tasks:
    print(&quot; No tasks found.&quot;)
    return
print(&quot;\n--- All Tasks ---&quot;)
for i, task in enumerate(tasks, start=1):
    deadline_str = task[&quot;deadline&quot;].strftime(&quot;%Y-%m-%d&quot;) if task[&quot;deadline&quot;] else &quot;No deadline&quot;
    print(f&quot;{i}. {task['title']} | Priority: {task['priority']} | Deadline: {deadline_str}&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;def show_today_tasks():&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;today = datetime.date.today()
today_tasks = [t for t in tasks if t[&quot;deadline&quot;] == today]

if not today_tasks:
    print(&quot; No tasks for today!&quot;)
    return

print(&quot;\n--- Today's Tasks ---&quot;)
for i, task in enumerate(today_tasks, start=1):
    print(f&quot;{i}. {task['title']} | Priority: {task['priority']}&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;def delete_task():&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;show_all_tasks()
if not tasks:
    return
try:
    index = int(input(&quot;Task number to delete: &quot;)) - 1
    if 0 &amp;lt;= index &amp;lt; len(tasks):
        removed = tasks.pop(index)
        print(f&quot; Task '{removed['title']}' deleted.&quot;)
    else:
        print(&quot; Invalid number.&quot;)
except ValueError:
    print(&quot; Invalid input. Enter a number.&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;main-program&quot;&gt;Main program&lt;/h2&gt;
&lt;p&gt;while True:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;show_menu()
choice = input(&quot;Your choice: &quot;)

if choice == &quot;1&quot;:
    add_task()
elif choice == &quot;2&quot;:
    show_all_tasks()
elif choice == &quot;3&quot;:
    show_today_tasks()
elif choice == &quot;4&quot;:
    delete_task()
elif choice == &quot;5&quot;:
    print(&quot; Thanks for using Student To-Do App. Good luck!&quot;)
    break
else:
    print(&quot; Invalid choice, try again.&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Step 2: How It Works&lt;br&gt;
1/ Add a task: Enter the task name, priority, and optional deadline.&lt;/p&gt;
&lt;p&gt;2/ Show all tasks: See a list of all your tasks with their priority and deadline.&lt;/p&gt;
&lt;p&gt;3/ Show today’s tasks: Only display tasks due today.&lt;/p&gt;
&lt;p&gt;4/ Delete a task: Remove a task by its number in the list.&lt;/p&gt;
&lt;p&gt;5/ Quit: Exit the application.&lt;br&gt;
Step 3: Possible Improvements&lt;br&gt;
-Add file saving so tasks remain after closing the program.&lt;/p&gt;
&lt;p&gt;-Create a GUI version using Tkinter or Streamlit.&lt;/p&gt;
&lt;p&gt;-Add a Pomodoro timer to help stay focused.&lt;br&gt;
Conclusion&lt;br&gt;
This simple Python project helps you practice basic Python concepts like lists, dictionaries, loops, and user input. You can expand it into a bigger project, like a fully-featured To-Do App or a study planner.&lt;/p&gt;
&lt;p&gt;Try it yourself, modify it, and share your version with the CoderLegion community! &lt;/p&gt;
</description>
<category>Python</category>
<guid isPermaLink="true">https://coderlegion.com/5544/create-a-simple-to-do-list-in-python-stay-organized</guid>
<pubDate>Wed, 24 Sep 2025 20:47:33 +0000</pubDate>
</item>
</channel>
</rss>