Post

Python Developer
Python Developer@Python_Dv·
Comment your answer now ⬇️
Python Developer tweet media
English
14
6
65
7.8K
Earnest Codes
Earnest Codes@Earnesto037·
@Python_Dv The correct answer is C) [1, 3]. The Logic: Slicing Syntax In Python (and NumPy), the syntax for slicing an array is [start:stop:step]. In the code, the instruction is a[::2]: Start: (Empty) Defaults to the beginning of the array (index 0). Stop: (Empty) Defaults to the end
English
1
0
2
463
Jenny
Jenny@JennyTheDev·
@Python_Dv C) [1 3] a = [1, 2, 3, 4] a[::2] means take every 2nd element starting from index 0. Indexes taken → 0 and 2 Values → 1 and 3 Output: [1 3]
English
0
0
1
348
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@Python_Dv Output: C. a[::2] means “take every 2nd element starting from index 0”, so it picks 1 and 3 (NumPy will print it as [1 3]).
English
0
0
0
47
Evil_Hunter
Evil_Hunter@imsmartVik·
@Python_Dv step is 2 counting will start from 0 . now calculate element 1 and 3
English
0
0
0
150
Prem Prakash
Prem Prakash@4EverPrem·
@Python_Dv [1 3] => it will be without the commas in between 1 and 3 numpy array slicing is same as Python list slicing.
English
0
0
0
151
Paylaş