Exercise

Generating a sequence of numbers

You may want to create an array of a range of numbers (e.g., 1 to 10) without having to type in every single number. The NumPy function arange() is an efficient way to create numeric arrays of a range of numbers. The arguments for arange() include the start, stop, and step interval as shown below:

np.arange(start, stop, step)

numpy is imported as np.

Instructions

100 XP
  • Create an array company_ids containing the numbers 1 through 7 (inclusive).
  • Create an array company_ids_odd containing only the odd numbers from 1 through 7 (inclusive).