Case_2
unknown
python
4 years ago
1.7 kB
4
Indexable
import os def clear(): if os.name == 'nt': os.system('cls') elif os.name == 'posix': os.system('clear') def menu(): print('*****************************') print(' Todoify ') print('-----------------------------') print('list | List todos ') print('add | Add todo ') print('check | Check todo ') print('delete | Delete todo ') print('-----------------------------') print('save | Save todos to file ') print('load | Load todos from file') print('---------------------------') todo = [] index = 0 def list_todo(): global todo, item for item in todo: print('[ ]', item) def add(): print('---------------------------') todo.append(input('Todo description > ')) def check(): print('---------------------------') global index, item print(index(item)) #for item in todo: #print(index, '| [ ]', item) #index += 1 def delete(): del todo print('---------------------------') while True: menu() selection = input('Selection > ') if selection == 'list': list_todo() elif selection == 'add': add() elif selection == 'check': check() elif selection == 'delete': pass elif selection == 'save': pass elif selection == 'load': pass else: print(' ') print('ERROR: Unknown command', '(' + selection + ')') print(' ') print('---------------------------') input('Press enter to continue...') clear()
Editor is loading...