In [3]:
#!/usr/bin/python

print("Hello, this is a To-Do List program!")
print("This program allows you to add, view, remove, count, clear, and mark as completed all your tasks you have in your To-Do List!")
print("")

toDoList = []

def addItems(toDo):
    toDoList.append({"toDo":toDo, "completed":False})
    return "Your task was added to your To-Do List."

def viewItems(toDo):
    if len(toDoList) == 0:
        return "There are no tasks in your To-Do List."
    else:
        itemList = ""
        for form, toDo in enumerate(toDoList, start = 1):
            progress = "✅" if toDo["completed"] else "❌"
            itemList += f"{form}.{progress}{toDo['toDo']}\n"
        return itemList
    
def removeItems(toDo):
    if num >= 1 and num <= len(toDoList):
        toDoList.pop(num - 1)
        return "Your task was removed in your To-Do List."
    else:
        return "There is no task like this in your To-Do List anymore."
    
def completedItems(num):
    if num >= 1 and num <= len(toDoList):
        toDoList[num - 1]["completed"] = True
        return "This task has been marked as complete in your To-Do List."
    else:
        return "Error. This is not a number from your list." 

def clearItems():
    toDoList.clear()
    return "All of your tasks from your To-Do List have been cleared."
    
def amountItems():
    amount = len(toDoList)
    if amount == 0:
        return "There are no tasks in your To-Do List."
    elif amount == 1:
        return "You only have 1 task in your To-Do List."
    else:
        return f"The amount of tasks in your To-Do List is {amount}."    
    
while True:
    print("")
    print("Which in the following list would you like to perform? ")
    print("1. Add an Item")
    print("2. View the Items")
    print("3. Remove an Item")
    print("4. Mark Completed Items")
    print("5. Clear all Items")
    print("6. Check Number of Items")
    print("7. Leave")
    
    print("")
    decision = input("Enter what your decision is from (1-7): ")
    print("")
    
    if decision == "1":
        toDo = input("Enter a task you would like to add in your To-Do List: ")
        decided = addItems(toDo)
        print(decided)
    elif decision == "2":
        decided = viewItems(toDo)
        print(decided)
    elif decision == "3":
        num = int(input("Enter the task you would like to remove in your To-Do List in numbers: "))
        decided = removeItems(num)
        print(decided)
    elif decision == "4":
        num = int(input("Enter the task you would like to mark as complete in your To-Do List in numbers: "))
        decided = completedItems(num)
        print(decided)    
    elif decision == "5":
        decided = clearItems()
        print(decided)
    elif decision == "6":
        decided = amountItems()
        print(decided)
    elif decision == "7": 
        print("The program has ended! ")
        print("Have a Good Day!! :) ")
        break
    else:
        print("Error. This is an invalid decision. Please try again!")
Hello, this is a To-Do List program!
This program allows you to add, view, remove, count, clear, and mark as completed all your tasks you have in your To-Do List!


Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 1

Enter a task you would like to add in your To-Do List: Garbage
Your task was added to your To-Do List.

Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 1

Enter a task you would like to add in your To-Do List: Dishes
Your task was added to your To-Do List.

Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 2

1.❌Garbage
2.❌Dishes


Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 4

Enter the task you would like to mark as complete in your To-Do List in numbers: 1
This task has been marked as complete in your To-Do List.

Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 2

1.✅Garbage
2.❌Dishes


Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 3

Enter the task you would like to remove in your To-Do List in numbers: 1
Your task was removed in your To-Do List.

Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 2

1.❌Dishes


Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 5

All of your tasks from your To-Do List have been cleared.

Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 6

There are no tasks in your To-Do List.

Which in the following list would you like to perform? 
1. Add an Item
2. View the Items
3. Remove an Item
4. Mark Completed Items
5. Clear all Items
6. Check Number of Items
7. Leave

Enter what your decision is from (1-7): 7

The program has ended! 
Have a Good Day!! :) 
In [ ]: