Skip to content

Instantly share code, notes, and snippets.

@alirezaahani
Created October 7, 2021 10:21
Show Gist options
  • Save alirezaahani/7f0f5c9d7279812653fe43610cd3c844 to your computer and use it in GitHub Desktop.
Save alirezaahani/7f0f5c9d7279812653fe43610cd3c844 to your computer and use it in GitHub Desktop.
Small notes program
notes = []
with open('Notes.txt', 'r') as f:
for i, l in enumerate(f):
l = l.strip()
print(i, l)
notes.append([l[:-4], l[-2] == 'X'])
while True:
try:
op = int(input('Mark as not finished: '))
except ValueError:
break
notes[op][1] = False
while True:
try:
op = int(input('Mark as finished: '))
except ValueError:
break
notes[op][1] = True
while True:
op = input('Add more notes: ')
if op == 'q' or op.isspace():
break
notes.append([op, False])
with open('Notes.txt', 'w') as f:
for i in notes:
output = i[0]
if i[1]:
output += ' [X]\n'
else:
output += ' [ ]\n'
f.write(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment