0
Create an array with 5 values & delete the value at index no. 2 without using in-built function???
from array import* arr = array('i', [12,45,78,56, 16]) for i in arr: if i==arr[2]: continue print(i) Can anyone tell me how 78 was deleted in the code??
2 Answers
+ 1
Priyanshu Patel
continue will skip current iteration and nothing will happen so here 78 will be skip but rest value will be print
0
def Del(index,array):
Arr=[]
i=0
for x in array:
if index!=i: Arr.append(x)
i+=1
return Arr
arr = [12,45,78,56, 16]
arr = Del(2,arr)
print(arr)