File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ # Simple To-Do List Manager (20-30 LOC)
2+
3+ tasks = []
4+
5+ def show_menu ():
6+ print ("\n 1. Add Task\n 2. View Tasks\n 3. Remove Task\n 4. Exit" )
7+
8+ while True :
9+ show_menu ()
10+ choice = input ("Choose: " )
11+
12+ if choice == "1" :
13+ task = input ("Enter task: " )
14+ tasks .append (task )
15+ print ("Task added!" )
16+
17+ elif choice == "2" :
18+ if not tasks :
19+ print ("No tasks yet." )
20+ else :
21+ for i , t in enumerate (tasks , 1 ):
22+ print (f"{ i } . { t } " )
23+
24+ elif choice == "3" :
25+ num = int (input ("Task number to remove: " ))
26+ if 1 <= num <= len (tasks ):
27+ tasks .pop (num - 1 )
28+ print ("Task removed!" )
29+ else :
30+ print ("Invalid number." )
31+
32+ elif choice == "4" :
33+ print ("Goodbye!" )
34+ break
35+
36+ else :
37+ print ("Invalid choice, try again." )
You can’t perform that action at this time.
0 commit comments