07-02-2020 05:56 AM
Hello All, I am new in this community and I am in learning face, I want to know the output syntax of deleting elements from an Array in Python. I have mention the input format but i don’t know about the final output. Can anyone suggest me.
import array as ar1 number = ar1.array('i', [11, 22, 33, 33, 44]) del number[2] # removes the third element print(number) del number # deletes the entire array print(number)
Solved! Go to Solution.
07-13-2020 03:25 PM
Just review this code and if you want to know more about Python Array.
import array as arr
number = arr.array('i', [1, 2, 3, 3, 4])
del number[2] # removing third element
print(number) # Output: array('i', [1, 2, 3, 4])
del number # deleting entire array
print(number) # Error: array is not defined
07-13-2020 03:25 PM
Just review this code and if you want to know more about Python Array.
import array as arr
number = arr.array('i', [1, 2, 3, 3, 4])
del number[2] # removing third element
print(number) # Output: array('i', [1, 2, 3, 4])
del number # deleting entire array
print(number) # Error: array is not defined
07-02-2020 08:35 AM
I use google for such questions.
try this: https://www.google.com/search?q=delete+element+from+array+python