Python program to remove element of specific position from list.

#Python program to remove element of specific position from list.

list1=[]


N=int(input("Enter Number of elements in list:"))

for i in range(N):
    array=int(input("Enter element for position %d:"% i))
    list1.append(array)


def delete():
    e=int(input("Press 1 to continue or 0 to exit:"))
    if e==1:
        p=int(input("Enter position of element to delete:"))
        del list1[p]
        print("New linked list is:")
        display()
    else:
        exit

def display():
    print(list1)
    delete()
delete()

Comments

Popular posts from this blog

Python program to calculate age and year when user will be 100 years old

Python program to print numbers less than 5 from the list.