In this article we are going to discuss about getting the address of an particular element in the Python array. In python we can create the array using numpy. Numpy stands for numeric python used to create and process arrays. We have to import numpy module
It will return the memory of that element present at the given index. Given below are implementations for the same.
The element present at 4 th index - element 5 : <memory at 0x7f9e01221680>
The element present at 5 th index - element 6 : <memory at 0x7f9e01221680>
The element present at 1 st index - element 2 : <memory at 0x7f9e01221680>
The element present at 0 th index - element 1 : <memory at 0x7f9e01221680>
We can get all the memory details by using this method so obviously memory address will also be returned.
The element present at 4 th index - element 5 : {'data': (94734975551568, False), 'strides': None, 'descr': [('', '<i8')], 'typestr': '<i8', 'shape': (), 'version': 3, '__ref': array(5)}
The element present at 5 th index - element 6 : {'data': (94734975551568, False), 'strides': None, 'descr': [('', '<i8')], 'typestr': '<i8', 'shape': (), 'version': 3, '__ref': array(6)}
The element present at 1 st index - element 2 : {'data': (94734975551568, False), 'strides': None, 'descr': [('', '<i8')], 'typestr': '<i8', 'shape': (), 'version': 3, '__ref': array(2)}
The element present at 0 th index - element 1 : {'data': (94734975551568, False), 'strides': None, 'descr': [('', '<i8')], 'typestr': '<i8', 'shape': (), 'version': 3, '__ref': array(1)}