I have written the python code below to create a database:
list = ["a","b","c","d","e"]
while(True):
print("1/insert")
print("2/delete")
print("3/quit")
print("4/display")
choice=int(input("enter your choice: "))
if choice==1:
name=input("enter a name:")
list.insert(1,name)
if choice==2:
dltname=input("enter the name you want to delete")
list.remove(dltname)
if choice == 3:
exit()
if choice==4:
print(list)
When I first insert an item, it's inserted in the 1st index position, my goal is when I insert the next item, I want to insert it in the 3rd index positon, the next one in the 5th index positon, means I want to insert each item in the next available odd index position. Can I get help about how to do this? Thank you!
I tried to use n=1 whose value increases by 2 every time 1 is chosen as option, but couldn't do it.