r/PythonLearning • • Apr 27 '26

Showcase the task thing’s easy 😅

Post image

i wrote it but the save/load part is ai, rest is all me. what y'all think?

63 Upvotes

21 comments sorted by

View all comments

1

u/nuc540 Apr 28 '26

Never do equality checks with a magic value left of the operator.

Also validate index is greater than 0 outside the if guarding, chained comparison is fine but you’re also depending on every value to be a certain way, so just validate, exit early, then only compare the 2 values needed for your new_task loop.

Also the try block is guarding too much, it is checking the input but it houses task editing too.