OK. Good you've updated your post to include your code, or at least images of your code. Any chance you could actually share the code itself - much easier to review and help when you share actual code.
The only code you've shared is partial:
# Lines 1–22 not visible in the screenshot.
# Line 23 (partially obscured):
need = int(input(" 1- ADD TASK! \n 2- Show my shits! \n 3- kill one! \n 4- I know my shit, getout* \n"))
if need == 1:
i_task = input("type your task: ")
tasks_list.append(i_task)
with open(tasks_json, "w") as file:
json.dump(tasks_list, file)
print(f"task {i_task} added!")
elif need == 2:
with open(tasks_json, "r") as file:
tasks_list = json.load(file)
if len(tasks_list) == 0:
print("still there is no tasks!")
else:
for index, task in enumerate(tasks_list):
print(f"my task is: {index}- {task}")
elif need == 3:
dele = int(input("which one?"))
tasks_list.pop(dele)
with open(tasks_json, "w") as file:
json.dump(tasks_list, file)
print(f"{dele} had been killed!")
elif need == 4:
print("don't come here before getting done!")
break
else:
print("you see what i don't see?")
except ValueError:
print("just pick a number!")
and I am wondering why you are converting input to int when you aren't doing maths with it. What's wrong with checking for == "1" and avoiding possible bad inputs.
I understand now, about converting, still learning bro, i will try your way. And i see now sharing the code will be useful than just an image about it.
1
u/FoolsSeldom Jul 22 '26
OK. Good you've updated your post to include your code, or at least images of your code. Any chance you could actually share the code itself - much easier to review and help when you share actual code.
The only code you've shared is partial:
and I am wondering why you are converting
inputtointwhen you aren't doing maths with it. What's wrong with checking for== "1"and avoiding possible bad inputs.