NumPy: Find the 4th element of a specified array
NumPy: Array Object Exercise-50 with Solution
Write a NumPy program to find the 4th element of a specified array.
Python Code :
import numpy as np x = np.array([[2, 4, 6], [6, 8, 10]], np.int32) print(x) e1 = x.flat print("Forth e1ement of the array:") print(e1)
[[ 2 4 6] [ 6 8 10]] Forth e1ement of the array: 6
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?
Test your Python skills with w3resource's quiz
Python: Tips of the Day
>>> m = [x ** 2 for x in range(5)] >>> m [0, 1, 4, 9, 16]
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- 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