Write a NumPy program to create a 2-dimensional array of size 2 x 3 (composed of 4-byte integer elements), also print the shape, type and data type of the array

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

Write a NumPy program to create a 2-dimensional array of size 2 x 3 (composed of 4-byte integer elements), also print the shape, type and data type of the array.

الأجوبة

import numpy as np
x = np.array([[2, 4, 6], [6, 8, 10]], np.int32)
print(type(x))	
print(x.shape)
print(x.dtype)

Sample Output:

<class 'numpy.ndarray'>                                                
(2, 3)                                                                 
int32
هل كان المحتوى مفيد؟

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

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