Given following ndarray A1: array([[1,2,3], [4,5,6], [7,8,9]]) What will be the output produced by the following array slices? (i) A1[: : 3,: : 2] (ii) A1[: : -1,: : -1] *
Answers
Answered by
1
I. [ [1 3] ]
II. [ [9 8 7]
[6 5 4]
[3 2 1] ]
Answered by
0
Answer: The answer is based on python programming language.
Slicing: The method of slicing a sequence can be specified with the help of a slice object. You have the ability to choose where the slicing begins and where it comes to a conclusion. In addition, you have the option of specifying the step, which enables you to do things like slice only every other item.
Python: Python is a programming language use to code software's, app and handle AI and ML features.
Explanation:
- Given Array ([[1,2,3],[4,5,6],[7,8,9]])
- The output by A1[::3,::2] is [7,8,9]
- The output by A1[::-1,::-1] is [7,8,9]
- We can get the same thing by A1[2:3] and A1[-1]
- We used slicing technique in python to represent an array member from the n-dimensional array
- It reduces effort and time
#SPJ2
Similar questions