Exercise 554

Give the python code numpy which generates the matrix: A = np.array ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) via the linespace() method

Solution

import numpy as np
A = np.linspace(0 , 10 , 11 , dtype = int)
print(A)
# The output is : [ 0 1 2 3 4 5 6 7 8 9 10]

Younes Derfoufi
my-courses.net

Leave a Reply