To-Do List Application

Currently reading:
 To-Do List Application

Bluetweak

Member
LV
0
Joined
Aug 2, 2023
Threads
11
Likes
0
Awards
2
Credits
1,101©
Cash
0$
print("To-Do List Application")
tasks = []

while True:
print("1. Add Task")
print("2. View Tasks")
print("3. Mark Task as Completed")
print("4. Exit")

choice = int(input("Enter your choice: "))

if choice == 1:
task = input("Enter the task: ")
tasks.append({"task": task, "completed": False})
print("Task added successfully!")
elif choice == 2:
print("Tasks:")
for i, task in enumerate(tasks, 1):
status = "Completed" if task["completed"] else "Pending"
print(f"{i}. {task['task']} - {status}")
elif choice == 3:
task_number = int(input("Enter the task number to mark as completed: "))
if 1 <= task_number <= len(tasks):
tasks[task_number - 1]["completed"] = True
print("Task marked as completed!")
else:
print("Invalid task number.")
elif choice == 4:
print("Exiting the application.")
break
else:
print("Invalid choice. Please try again.")
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips

Similar threads

Top Bottom