-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlista.py
More file actions
29 lines (24 loc) · 756 Bytes
/
lista.py
File metadata and controls
29 lines (24 loc) · 756 Bytes
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
tasks = []
while True:
print("\n1. shown\n2. add\n3. remove\n4. exit")
choice = input("choose(1-4):")
if choice == "1":
print("tasks" if tasks else "No tasks")
for i,t in enumerate (tasks,1):
print (f'{i}.{t}')
elif choice == "2":
task = input ("New Task: ").strip()
tasks.append(task)
elif choice == "3":
for i, t in enumerate(tasks, 1):
print(f"{i}.{t}")
try:
idx = int(input("remove task #: "))
if 1<= idx <= len(tasks):
tasks.pop(idx -1)
except:
print("Invalid Input.")
elif choice == "4":
break
else:
print("invalid Choice.")