import numpy as np # Create a numpy array arr = np.array([1, 2, 3, 4, 5]) # Make the array read-only using the setflags method arr.setflags(write=False) # Try to modify the array - this will raise a ValueError arr[0] = 10