NumPy: Get the element-wise remainder of an array of division
NumPy Mathematics: Exercise-6 with Solution
Write a NumPy program to get the element-wise remainder of an array of division.
import numpy as np x = np.arange(7) print("Original array:") print(x) print("Element-wise remainder of division:") print(np.remainder(x, 5))
Original array: [0 1 2 3 4 5 6] Element-wise remainder of division: [0 1 2 3 4 0 1]
Python-Numpy 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 Programming skills with w3resource's quiz.
Python: Tips of the Day
Invokes the provided function after ms milliseconds:
from time import sleep def tips_delay(fn, ms, *args): sleep(ms / 1000) return fn(*args) print(tips_delay( lambda x: print(x), 1000, 'w3r' ))
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- 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