Q:

Write a NumPy program to create an array of 10's with the same shape and type of a given array. Sample array: x = np.arange(4, dtype=np.int64)

0

Write a NumPy program to create an array of 10's with the same shape and type of a given array.
Sample array: x = np.arange(4, dtype=np.int64)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.arange(4, dtype=np.int64)
y = np.full_like(x, 10)
print(y)

Sample Output:

[10 10 10 10]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now