@extends('template') @section('title') Lab 9: Aside: range, arange @stop @section('content') # Lab 9: Aside: range, arange Early on in this semester, we learned that the built-in Python function `range` can be used to generate a list of integers: ```py range(4) # [0,1,2,3] ``` The module `numpy` has a similar function called `arange`, which is just like range except it has the ability to create floating point numbers in addition to whole numbers. ```py # Don't forget to add this import at the top of your file! import numpy as np np.arange(4) # [0,1,2,3] # Force floating point numbers np.arange(4.0) # [ 0., 1., 2., 3.] # Use + .5 to add .5 to each number in the list; useful for positioning bar charts! np.arange(4) + .5 # [ 0.5, 1.5, 2.5, 3.5] ``` @include('/labs/lab09/_toc') @stop