import array as arr
# Creating an array of integers
my_array = arr.array('i', [10, 20, 30, 40, 50])
# Displaying the original array
print("Original array:")
for i in my_array:
print(i, end=" ")
print()
# Changing the value of an element
my_array[2] = 35
# Displaying the modified array
print("Modified array:")
for i in my_array:
print(i, end=" ")
print()
Original array:
10 20 30 40 50
Modified array:
10 20 35 40 50
array()
` constructor. We then display the original array using a `for
` loop.[]
`. Finally, we display the modified array using another `for
` loop.