Computer Science, asked by bhuptanivipul928, 4 months ago

write a program in python to input a list of numbers in ask for a new element in its position then insert element at the given position.​

Answers

Answered by ershadahmad400
2

Answer:

input is automatic system recharge Central बिकाऊ सैनी फेस्टिवल फ्लैग ऑन द बैटरी डिस्किसी ऐप के द्वारा आप नहीं हो सकते हैं कृपया अपना ऐप भेजेंचार्ज क्लग में भरने के बाद वरना ऑटोमेटिक चार्ज लेता है आप किसी भी व्यक्ति से कॉल करें तो आप बच्चा जो नहीं लेगा आप कृपया बने रहे

Answered by toniblair9201
0

Answer:

here is your answer  please rate

Explanation:

def insert_spec_position(x, n_list, pos):

   return n_list[:pos-1]+[x]+n_list[pos-1:]

n_list = [1,1,2,3,4,4,5,1]

print("Original list:")  

print(n_list)

kth_position = 3

x = 12

result = insert_spec_position(x, n_list, kth_position)

print("\nAfter inserting an element at kth position in the said list:")

print(result)

OUTPUT

Original list:

[1, 1, 2, 3, 4, 4, 5, 1]

After inserting an element at kth position in the said list:

[1, 1, 12, 2, 3, 4, 4, 5, 1]

Similar questions