Inserting a Given Element in List at Given Position in Python | In Hindi

preview_player
Показать описание
Inserting a Given Element in List at Given Position in Python | In Hindi

In this video, I have explained one shot video for Python Data Structure which comprises of Stack and Queue. I hope you all will like this video.

Join this channel to get access to perks:

Tags Used:

python list programs
python list
python list program for board exam
important list program for board exam
python list important program
python list program example
list programming
codeitup
codeitup python
python codeitup
list programming
inserting a given element in list at given position in python
python program to insert an element at given position
insert element in list
how to insert element in list at a given position

#codeitup
#list
#python
Рекомендации по теме
Комментарии
Автор

a=[]
n = int(input("Enter the size of array: "))
def add():
for i in range(n):
temp = input("enter value: ")
a.append(temp)
print("all elements have been added")

def inse():
ele = int(input("enter the element you want to insert: "))
ind = int(input("enter the index position: "))
a.append(None)
for i in range(n-1, ind-2, -1):
a[i+1]=a[i]
a[ind]=ele
print(a)

sanukumar
Автор

9:13 sir we can use this logical part also
e=int(input("enter element"))
P=int(input ("enter index position "))
a.append(e)
t=a[p]
a[p]= a[s]
a[s]= t

ashmittripathi
Автор

Thank you so much sir for making us fall in love with coding 😊

diyajain
Автор

Sir u have given pos-2, how do u know user will insert no at 2nd index.

ashutoshupadhyay
Автор

Thanku So much sir for this ♥️.It Helps a lot..Again thanku sir 🙏

srijankesharwani
Автор

Excuse me sir . It will be user choice the position will also by decided by the user. So in for loop why we take pos -2 it could be anything according to the user

ravengaming
Автор

Wow bhaiya i was waiting for this plz make two videos a day

sardarji
Автор

a = [1, 3, 4, 5]
ele = int(input("enter element: "))
ind = int(input("enter index position: "))
new = a[:ind] + [ele] + a[ind:]

print(new)

sanukumar
Автор

Don't know why number of likes are less, I have learn every basics from your lectures only. you can upload data structure and please connect me on any other platform so that I can take guide from you.

milipandey
Автор

Sirr ji function ke program ke nhi ate ...

Priyanshum
Автор

There is one logical error in this program :
After appending None to the list the size of list increases by 1 so in range

libinalex