Post

@Python_Dv ✅ Option C: [1,3] 😎
a[::2] takes every 2nd element starting from index 0.
Watch my slicing cheat sheet :
x.com/PyBerryTech/st…
English

@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

@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

@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

@Python_Dv step is 2 counting will start from 0 .
now calculate element 1 and 3
English

@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









