Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
348 B
1
Indexable
Never
list=[2,5,7,8,10,45,66]
print("The original sorted list is",list)
element=int(input("Enter an element:"))
            
print("The element to be inserted to list is:",element)
l=len(list)
index=0
for i in range(l):
    if list[i]>element:
        index=i
        break
list=list[:index]+[element]+list[index:]
print("The updated array list is",list)
Leave a Comment