Skip to content
C

Problem 3: Select Specific Elements Using Fancy Indexing

Easypython

Problem Description

Write a Python program that selects elements at specific given index positions from an array using fancy indexing.

Input

An array and a list of index positions.

Output

The selected elements, in the specified order.

Constraints

  • Index positions must be valid for the array's length.

Example Input

text
array=[10,20,30,40,50], indices=[4,0,2]

Example Output

text
Selected: [50 10 30]

Concepts Covered

Fancy indexing.

Input (stdin)

Output

Run your code to see output here...