NumPy: Multiply the values of two given vectors
NumPy: Basic Exercise-24 with Solution
Write a NumPy program to multiply the values of two given vectors.
Sample Solution :
Python Code :
import numpy as np x = np.array([1, 8, 3, 5]) print("Vector-1") print(x) y= np.random.randint(0, 11, 4) print("Vector-2") print(y) result = x * y print("Multiply the values of two said vectors:") print(result)
Vector-1 [1 8 3 5] Vector-2 [1 6 4 6] Multiply the values of two said vectors: [ 1 48 12 30]
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework