Hello. I just moved from c++ when i undrstud that c++ is to hard for me and i moved to python and i tried to make small to do list project and i would like to have feedback about this code hove much mistakes i made and dont be shy say all what you want here about code i will take your advices and will learn from them.
import os
import time
def options():
print('\nTODO-LIST')
print('1. Add task')
print('2. View tasks')
print('3. Remove tasks')
print('4. Close program')
print('5. Save tasks in txt file')
def list(array):
for x, array in enumerate(array, start=0):
print(f"{x}. {array}")
array = []
while True:
options()
choice = input("Option: ")
try:
check = int(choice)
if check == 1:
task = input ('How much tasks you want to add: ')
for x in range(int(task)):
newtask = input('New task: ')
array.append(newtask)
print('Task successfully added')
elif check == 2:
print('2')
elif check == 3:
list(array)
while True:
delete = input('Number fo choice for delete: ')
if int(delete) <= 1 <= len(array) :
print('Works')
break
else:
print(f'Number need to be betwen 0 - {len(array) - 1}')
elif check == 4:
print()
elif check == 5:
print('Saved')
except:
print('Option needs to be number')
@whole sequoia