## 3: The math module

### Instructions

Use the sqrt() function within the math module to assign the square root of 16.0 to a.

Use the ceil() function within the math module to assign the ceiling of 111.3 to b.

Use the floor() function within the math module to assign the floor of 89.9 to c.

``````

In [1]:

import math

``````

``````

In [2]:

a = math.sqrt(16.0)
b = math.ceil(111.3)
c = math.floor(89.9)

``````
``````

In [3]:

print(a, b, c)

``````
``````

4.0 112 89

``````

## 4: Variables within modules

### Instructions

Assign the square root of pi to a.

Assign the ceiling of pi to b.

Assign the floor of pi to c.

``````

In [4]:

import math

print(math.pi)

``````
``````

3.141592653589793

``````

``````

In [5]:

PI = math.pi
a = math.sqrt(PI)
b = math.ceil(PI)
c = math.floor(PI)

``````
``````

In [6]:

print(a, b, c)

``````
``````

1.7724538509055159 4 3

``````

## 5: The csv module

### Instructions

Read in all of the data from "nfl.csv" into a list variable named nfl using the csv module.

``````

In [9]:

import csv

f = open("nfl.csv")

``````
``````

In [10]:

print(nfl)

``````
``````

``````

## 6: Counting how many times a team won

### Instructions

Fill in the mission code to do the following:

Import and use the csv module to load data from our "nfl.csv" file.

Count how many games the "New England Patriots" won from 2009-2013. To do this, set a counter to 0, and increment by 1 whenever you see a row whose winner column is equal to "New England Patriots".

Assign the count to patriots_wins.

``````

In [12]:

import csv

f = open("nfl.csv")
patriots_wins = 0

for row in data:
if row[2] == "New England Patriots":
patriots_wins += 1
print(patriots_wins)

``````
``````

10

``````
``````

In [ ]:

``````