I was given this question and I'm not sure why I'm getting an error with my code.
Question 4. Suppose there were 30,000 beachgoers in 1930 and the number of beachgoers increased by 15% year-after-year. Create an array called beachgoers that contains the number of beachgoers in each year between 1930 and 2017. If any beachgoer is equally likely to be attacked by a shark, how dangerous was the least dangerous year for shark attacks? Assign the percent chance of being attacked by a shark to the variable danger. Hint: To calculate beachgoers, you may find the function np.arange helpful.
yearly_growth_rate = 30000 * 1.15 ** np.arange(1, 88) - 30000
final_number = 30000 * (1.15 ** 88)
beachgoers = np.arange(30000, final_number, yearly_growth_rate)
beachgoers
#danger = ...
This is the error I'm getting
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-57-df37b4a34579> in <module>()
1 yearly_growth_rate = 30000 * 1.15 ** np.arange(1, 88) - 30000
2 final_number = 30000 * (1.15 ** 88)
----> 3 beachgoers = np.arange(30000, final_number, yearly_growth_rate)
4 beachgoers
5 #danger = ...
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Thanks for the help in advance