mirror of https://github.com/01-edu/Branch-AI.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
688 B
688 B
-
This question is validated if the solution doesn't involve a for loop or writing all integers from 1 to 100 and if the array is:
np.array([1,...,100])
. The list from 1 to 100 can be generated with an iterator:range
. -
This question is validated if the solution is:
integers[::2]
-
This question is validated if the solution is:
integers[::-2]
-
This question is validated if the array is:
np.array([0, 1,0,3,4,0,...,0,99,100])
. There are at least two ways to get this results without for loop. The first one usesintegers[1::3] = 0
and the second involves creating a boolean array that indexes the array:
mask = (integers+1)%3 == 0
integers[mask] = 0