python program to copy an array as another array using copy method
python program to copy an array as
another array using copy method
=============================
Code:
from numpy import *
a = arrange(1,6)
# this method creates a copy of array
b = a.copy()
print('Original Array',a)
print('New Array',b)
b[0]=20
print('After Modification')
print('Original Array:',a)
print('New Array:',b)
Output :
Original Array:[1,2,3,4,5]
New Array:[1,2,3,4,5]
After Modification
Original Array:[1,2,3,4,5]
New Array:[20,2,3,4,5]
No comments:
Post a Comment