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)

  • برمجة بايثون

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)

الأجوبة

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]
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...