[top] [TitleIndex] [WordIndex]


Grading Criteria for Assignment 2

Problem 1

This one should be pretty straightforward -- you could check to see if their code does something vaguely reasonable in the case of non-positive input. Probably the most likely error you're going to see is an off-by-one issue with how many things they return.

Problem 2

The problem has a good set of things to test out, but here are some other inputs to try:

>>> flatten([[[]]])
>>> flatten([[[]], [[]]])

Problem 3

The problem statement has some pretty good coverage. You should also check to see if the function only substitutes one level deep (as opposed to nested the whole way in).

Problem 4

Try this one out, especially with some hyphenated names.

Problem 5

You can always check to make sure that if you pass a second argument larger than the first, the function either produces an error or goes into an infinite loop. (Note that there are plenty of permutations, but not enough that satisfy the third condition in the problem.)

Problem 6

Try out a few by hand -- you can try this in Sage, if you'd like:

sage: sum(divisors(100)) - 100
sage: sum(divisors(496))

(Note that I'm subtracting the input because our function does not include the number itself, but Sage's does.)

Problem 7

Again, you can try this out from sage:

sage: sage.symbolic.pynac.doublefactorial(9)
sage: 9*7*5*3*1

One caveat: it's defined slightly differently, so it'll only give the same answers as ours for odd input.

Problem 8

The thing to check here is that the output correctly grows and shrinks with the input lists -- the example in the problem statement does this, but try out a few more yourself.

Problem 9

Again, try this one out. A clever example someone asked me about by email is the case where the destination directory is a subfolder of the source directory -- this should probably be undefined, but is bound to cause interesting errors.

2013-05-11 18:32