Daily Data Science Puzzle
import numpy as np
# save $122.50 per month
x = 122.5
net_wealth = np.arange(0, 1000, x)
# how long to save >$1000?
What is the output of this puzzle?
Numpy is a popular Python library for data science focusing on linear algebra.
This puzzle is about the numpy arange function. The arange function is everywhere in data science.
You might know the Python built-in
range(x,y,z) function that creates a sequence of linear progressing values. The sequence starts from x, increases the values linearly by y, and ends if the value becomes larger than z.
arange(x,y,z) function is similar but creates a numpy array and works with float numbers as well.
Note that a common mistake in this puzzle is to not account for the first value of the array: 0.
Are you a master coder?
Test your skills now!