-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTo-Do List App
56 lines (44 loc) · 1.48 KB
/
To-Do List App
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
task = []
def addTask()
task = input("Please enter a task: ")
tasks.append(task)
print(f"Task '{task}' added to the list.")
def listTasks():
if not tasks:
print("There is no task currently.")
else:
print("Current Tasks:")
for index, task in enumerate(tasks):
print(f"Task #{index}. {task}.")
def deleteTask():
listTasks()
try:
taskToDelete = int(input("Enter the # to delete the))
if taskToDelete >=0 and taskToDelete < len(tasks):
tasks.pop(taskToDelete)
print(f"Task{taskToDelete} has been removed.")
else:
print(f"Task #{taskToDelete} was not found.")
if __name__== "__main__":
### Create a loop to run on the app
print("Welcome to the To-Do List app!")
while True:
print("\n")
print("Please select one of the following options")
print("------------------------------------------")
print("1. Add a task")
print("2. View all tasks")
print("3. Exit")
Print("------------------------------------------")
choice = input("Enter our choice ")
if(choice == "1"):
addTask()
elif(choice == "2"):
deleteTask()
elif(choice == "3"):
listTasks()
elif(choice == "4"):
break
else:
print("Invalid input. Please try again.")
print("Thank you for using the To-Do App!")