Answer to Question #314309 in Python for xxx

Question #314309

1.Convert the 1-D array to 3-D array

a = np.array([x for x in range(32)])


Answer:


print(o)


Output:

array([[[ 0, 1, 2, 3, 4, 5, 6, 7],

    [ 8, 9, 10, 11, 12, 13, 14, 15]],


    [[16, 17, 18, 19, 20, 21, 22, 23],

    [24, 25, 26, 27, 28, 29, 30, 31]]])


2.Convert the value in the array to appropriate data type

a = np.array([[7.2, 5.4, 9.3],

       [3.8, 6.7, 8.5]])


Answer:


print(o)


Output:

[[7 5 9]

 [3 6 8]]


3.Extract value in between 7 to 15 from the given array

a = np.array([2, 6, 1, 9, 10, 3, 27])


Answer:


print(o)


Output:

[ 8 12 9 11]


1
Expert's answer
2022-03-19T12:25:21-0400
import numpy a np
a = np.array([x for x in range(32)])
a.reshape(3, 3)

list1 = []
for i in a:
    if 7 < i < 15:
       list1.append(i)
print(list1)


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS