You can use np.arange() function to generate a range of numbers and np.reshape() function to reshape the array into a 3×3 matrix.
import numpy as np
def create_matrix():
return np.arange(2, 11).reshape(3,3)
print(create_matrix())
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.