numpy.put() in Python Last Updated : 08 Mar, 2024 Comments Improve Suggest changes Like Article Like Report The numpy.put() function replaces specific elements of an array with given values of p_array. Array indexed works on flattened array. Syntax: numpy.put(array, indices, p_array, mode = 'raise') Parameters : array : array_like, target array indices : index of the values to be fetched p_array : array_like, values to be placed in target array mode : [{‘raise’, ‘wrap’, ‘clip’}, optional] mentions how out-of-bound indices will behave raise : [default]raise an error wrap : wrap around clip : clip to the range Python # Python Program explaining # numpy.put() import numpy as geek a = geek.arange(5) geek.put(a, [0, 2], [-44, -55]) print("After put : \n", a) Output : After put : [-44, 1, -55, 3, 4] Python # Python Program explaining # numpy.put() import numpy as geek a = geek.arange(5) geek.put(a, 22, -5, mode='clip') print("After put : \n", a) Output : array([ 0, 1, 2, 3, -5]) Note : These codes won't run on online IDE's. So please, run them on your systems to explore the working. Comment More infoAdvertise with us Next Article numpy.put() in Python M Mohit Gupta Improve Article Tags : Python Python-numpy Python numpy-Indexing Practice Tags : python Similar Reads Python | numpy.putmask() method With the help of numpy.putmask() method, we can change the elements in an array with the help of condition and given value by using numpy.putmask() method. Syntax : numpy.putmask(array, condition, value) Return : Return the array having new elements according to value. Example #1 : In this example w 1 min read Input and Output in Python Understanding input and output operations is fundamental to Python programming. With the print() function, we can display output in various formats, while the input() function enables interaction with users by gathering input during program execution. Taking input in PythonPython input() function is 8 min read Python input() Function Python input() function is used to take user input. By default, it returns the user input in form of a string.input() Function Syntax: input(prompt)prompt [optional]: any string value to display as input messageEx: input("What is your name? ")Returns: Return a string value as input by the user.By de 4 min read Taking input in Python Developers often have a need to interact with users, either to get data or to provide some sort of result. Most programs today use a dialog box as a way of asking the user to provide some type of input. While Python provides us with two inbuilt functions to read the input from the keyboard. input () 3 min read Python 3 - input() function In Python, we use the input() function to take input from the user. Whatever you enter as input, the input function converts it into a string. If you enter an integer value still input() function converts it into a string.Python input() Function SyntaxSyntax: input(prompt)Parameter:Prompt: (optional 3 min read Like