# To-Do List App in Python
# Define a list to hold the tasks
tasks = []
# Function to add task to the list
def add_task():
task = input("Enter the task: ")
tasks.append(task)
print("Task added successfully!")
# Function to view all tasks in the list
def view_tasks():
if len(tasks) == 0:
print("No tasks found.")
else:
print("Tasks:")
for task in tasks:
print("- " + task)
# Function to remove task from the list
def remove_task():
task = input("Enter the task to be removed: ")
if task in tasks:
tasks.remove(task)
print("Task removed successfully!")
else:
print("Task not found.")
# Main function to run the app
def main():
while True:
print("\nTo-Do List App\n")
print("1. Add Task")
print("2. View Tasks")
print("3. Remove Task")
print("4. Exit")
choice = input("Enter your choice: ")
if choice == "1":
add_task()
elif choice == "2":
view_tasks()
elif choice == "3":
remove_task()
elif choice == "4":
print("Thank you for using the app!")
break
else:
print("Invalid choice. Please try again.")
# Run the app
if __name__ == "__main__":
main()