ezsequences / Week 5 / due 2018-02-07 23:59

Assignment notes here:

https://github.com/compciv/homeworkhome/tree/master/ezsequences

Basically, fill out the functions so that they pass the tests.

Requirements

When I visit your Github.com repo page

I expect your Github repo at compciv-2018-SUNETID repo to have the following subfolder:

compciv-2018-SUNETID/week-05/ezsequences/

On this subfolder’s page, I would expect the file tree to look like this:

└── ezlist.py
└── ezdict.py

When I clone your Github repo

If I were to clone your repo onto my own computer, e.g.

$ git clone https://github.com/GITHUBID/compciv-2018-SUNETID.git

I would expect your homework subfolder to look like this:

compciv-2018-SUNETID/
└── week-05/
    └── ezsequences/
        └── ezlist.py
        └── ezdict.py

Command-line setup

Creating the directory

$ cd ~/Desktop/compciv-2018-SUNETID
$ mkdir week-05
$ mkdir week-05/ezsequences
$ cd week-05/ezsequences

Downloading the skeleton files:

(for Windows, use curl.exe instead of curl)

$ curl -o ezdict.py 'https://compciv.github.io/homeworkhome/ezsequences/skeleton.ezdict.py'
$ curl -o ezlist.py 'https://compciv.github.io/homeworkhome/ezsequences/skeleton.ezlist.py'

And the test files:

$ curl -O 'https://compciv.github.io/homeworkhome/ezsequences/test_ezdict.py'
$ curl -O 'https://compciv.github.io/homeworkhome/ezsequences/test_ezlist.py'

To run the tests:

$ pytest

Add/commit to your git repo:

$ git add .
$ git commit -m 'first files'

Push to Github:

$ git push

Hints

How to do foo_i() for ezdict.py

def foo_i():
"""
Return the age that President Trump will be
 at the end of his initial term, i.e.
 the number of full years between his `'birthdate'`
 and the `'end_date'` of his initial term
Hint: You should be using the third-party `dateutil`
  library for this.
"""


import dateutil.parser
from dateutil.relativedelta import relativedelta

term = ez_dict['terms'][0]
ty = dateutil.parser.parse(term['end_date'])
tx = dateutil.parser.parse(ez_dict['birthdate'])
diff = relativedelta(ty, tx)
return diff.years