हिंदी

Create the following NumPy arrays: Use nested Python lists to create a 2-D array called myarray1 having 3 rows and 3 columns and store the following data:

Advertisements
Advertisements

प्रश्न

Create the following NumPy arrays:

Use nested Python lists to create a 2-D array called myarray1 having 3 rows and 3 columns and store the following data:

2.7, -2, -19
0, 3.4, 99.9
10.6, 0, 13
कोड लेखन
Advertisements

उत्तर

A 2-D NumPy array called myarray1 can be created using nested Python lists as follows:

import numpy as np
myarray1 = np.array
([
    [2.7, -2, -19],
    [0, 3.4, 99.9],
    [10.6, 0, 13]
])
print(myarray1)

Output:

[[2.7. -2. -19.]
[0. 3.4. 99.9]
[10.6. 0.

13.]]

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Introduction to NumPy - Exercise [पृष्ठ ११३]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 11
अध्याय 6 Introduction to NumPy
Exercise | Q 4. d) | पृष्ठ ११३
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×