Thursday, 31 October 2013

On Exercise 6

I’m actually disappointed this week’s exercise explicitly forbids it. I was wondering about whether or not last week's success was a fluke. However, this exercise did make me feel a bit nostalgic for the ease of CSC108. Also, it's been a while since I've used a 'while loop'. Some upper year CSC students I've spoken to mentioned that they rarely used any variation of a 'while loop', at all. I almost did this:

def __contains__(self, item):
            return str(item) in str(self)
out of sheer laziness, but I think I would’ve automatically failed for calling on a function that uses recursion even if I personally did not use it at all. I ended up doing something else which should work, although it has yet to undergo pre-marking. Once I get it pre-marked, though, I’ll resubmit with “return str(item) in str(self)”; I'm just really curious about whether or not it would be successful at all.

No comments:

Post a Comment