Astro 496

This is the course website for Astro 496, Spring 2018

Assignment 1 - Data Containers

Due: 2018-02-20

For this assignment, you are to construct a Jupyter notebook that explores data types in Python.

You should test these structures:

You will be graded on the writeup that accompanies this notebook. You should either do this writeup inline in the notebook or as a separate document. Here are some areas to address:

Here are a few tips:

An example of what the code might look like for a list is as follows:

import time

small = 10
medium = 10000
large = 10000000

small_list = []
medium_list = []
large_list = []

for i in range(small):

for i in range(medium):

for i in range(large):

Ntimes = 100

t1 = time.time()
for i in range(Ntimes):
t2 = time.time()

small_max = (t2 - t1)/Ntimes

t1 = time.time()
for i in range(Ntimes):
t2 = time.time()

medium_max = (t2 - t1)/Ntimes

t1 = time.time()
for i in range(Ntimes):
t2 = time.time()

large_max = (t2 - t1)/Ntimes

Here, note that we’re also increasing the size of the list! So we’d probably want to look at each of the times divided by the size of each list. That way, we’ll know how performance changes as a function of the size of the container.