Homework 5

Send your homework as a single ZIP archive with your files, or send a link to your GitHub repo. Try to keep line lengths below 80 characters.

EXERCISE 5.1

For a given directory (top) find the number of bytes taken by PDF files in the directory tree (".pdf" extensions). The code should be in the function find_pdf_size(top). In order to test the current directory we run find_pdf_size(".").

EXERCISE 5.2

Create the function print_working_days(date1, date2), where 'date1' and 'date2' are strings of the form 'YYYY-MM-DD'. The function prints dates of working days (from Monday to Friday) in the given range, 'date2' is excluded.

EXERCISE 5.3

Create the generator random_walk(start) for a 1D random walker. If a position at a certain moment is x, then the next position can be x+1 or x-1 with equal probabilities. Find the final position after 100 moves (start=0). Repeat experiments.