Q:

Write a NumPy program to calculate average values of two given numpy arrays

0

Write a NumPy program to calculate average values of two given numpy arrays.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
array1 = [[0, 1], [2, 3]]
array2 = [[4, 5], [0, 3]]
print("Original arrays:")
print(array1)
print(array2)
print("Average values of two said numpy arrays:")
result = (np.array(array1) + np.array(array2)) / 2
print(result)

Sample Output:

Original arrays:
[[0, 1], [2, 3]]
[[4, 5], [0, 3]]
Average values of two said numpy arrays:
[[2. 3.]
 [1. 3.]]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now