Answer to Question #310289 in Python for xxx

Question #310289

Question 1

a = np.array([[11,22,34],

              [48,56,60]])

b = np.array([[18,69,87],

              [52,26,35]])

Answer:


Question 1 Output:

array([[29,91,121],

       [100,82,95]])


Question 2

a = np.array([[8,9,10],

 [25,35,58]])

Answer:


Question 2 Output

array([[24,27,30],

       [75,105,174]])


Question 3

x = np.zeros(10)

print(x)

print("Update eighth value to 11")

Answer:


print(x)


Question 3 Output

[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]                              

Update fifth value to 66 and eighth value to 45                                               

[0. 0. 0. 0. 0. 66. 0. 0. 45. 0.]

1
Expert's answer
2022-03-13T01:11:25-0500
import numpy as np

print("Question 1:")
a = np.array([[11,22,34], [48,56,60]])
b = np.array([[18,69,87], [52,26,35]])
print("Array a:")
print(a)
print("Array b:")
print(b)
c = a + b
print("Ansver:")
print(c)
#  -----------------
print()
print("Question 2:")
a = np.array([[8,9,10], [25,35,58]])
print("Array a:")
print(a)
c = a * 3
print("Ansver:")
print(c)
#  -----------------
print()
print("Question 3:")
x = np.zeros(10)
print(x)
print("Update eighth value to 11")
x[8] = 11
print(x)
#  -----------------
print()
print("Question 4:")
x = np.zeros(10)
print(x)
print("Update fifth value to 66 and eighth value to 45")
x[5] = 66
x[8] = 45
print(x)

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