Problem

3 /12


Features of the selection of vector elements

Theory Click to read/hide

Selecting vector elements
To select vector elements, you can use a vector containing logical values ​​(expressions). The elements of the vector that will be True in the vector with boolean values ​​will be selected.
 

Example
import numpy as np V = np.array([1,-2,3,-4,5]) # select the first two elements of the vector print(V[np.array((True, True, False, False, False))]) # [ 1 -2] # select positive vector elements print(V[V > 0]) # [1 3 5] # select even vector elements print(V[V % 2 == 0]) # [-2 -4]

Problem

The input is two sets of integers, each in its own line. The numbers are space-separated. Create a vector V that will contain the numbers from the first set divided by the penultimate number from the second set, if the number from the first set is evenly divisible by the penultimate number from the second set.

If there are no such numbers, then the vector V will be empty (that is, it will not contain elements).

 

Examples
# Input Output
1 1 2 
10 10
[]
2 1 2 3 4 5 6
1 2 3 4
[1. 2.]