Created
October 7, 2021 10:21
-
-
Save alirezaahani/7f0f5c9d7279812653fe43610cd3c844 to your computer and use it in GitHub Desktop.
Small notes program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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