NumPy: Get the largest integer smaller or equal to the division of the inputs
NumPy Mathematics: Exercise-4 with Solution
Write a NumPy program to get the largest integer smaller or equal to the division of the inputs.
import numpy as np x = [1., 2., 3., 4.] print("Original array:") print(x) print("Largest integer smaller or equal to the division of the inputs:") print(np.floor_divide(x, 1.5))
Original array: [1.0, 2.0, 3.0, 4.0] Largest integer smaller or equal to the division of the inputs: [ 0. 1. 2. 2.]
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
Getting rid of unwanted characters:
You can get rid of whitespaces or any specific character using strip methods in Python. You can use either plain strip for both sides, lstrip for the left side and rstrip for the right side only.
str="+++Welcome python+++" str.strip() print(str)
- 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