Trusted answers to developer questions

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The

function in NumPy is used to return the remainder of the division of two input arrays (**fmod()**

numpy.fmod(x1, x2, /, out=None, *, where=True)

Syntax for the "fmod()" function

The `fmod()`

function takes the following parameter values:

**x1**

: This represents an input array of elements, which are the dividends. This is a required parameter value.**x2**

: This represents an array that contains the divisors. This is a required parameter value.**out**

**where**

: This is the condition over which the input is being broadcast. At a given location where this condition is `True`

, the resulting array will be set to the `ufunc`

result. Otherwise, the resulting array will retain its original value. This is an optional parameter value. ****kwargs**

: This represents the other keyword arguments. This is an optional parameter value.
The `fmod()`

function returns an array that contains the remainder of the division of the two given input arrays.

import numpy as np# creating input arraysx1 = np.array([1, 2, 3])x2 = np.array([1, 2, 2])# implementing the fmod() functionmyarray = np.fmod(x1, x2)print(x1)print(x2)print("The remainders values of the division are: ", myarray)

Implementing the "fmod()" function in NumPy

- Line 1: We import the
`numpy`

module. - Line 4: We create the input arrays,
`x1`

and`x2`

, using the`array()`

function. - Line 7: We implement the
`numpy.fmod()`

function on the input arrays. We assign the result to a variable called`myarray`

. - Lines 9–10: We print the input arrays
`x1`

and`x2`

to the console. - Line 11: We print the variable called
`myarray`

to the console.

RELATED TAGS

python

communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Related Courses