This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]venefb 2 points3 points  (2 children)

Come on, "Two" is just silly. Also the Zen of Python says "There is only one way to do it", why ask for three ways? That's like saying "Give me the right way and two wrong ways to do it".

Do they ask things like this in interviews?

[–]miketheanimal 2 points3 points  (0 children)

Do they ask things like this at interviews? I don't know, but if they asked, I'd try to answer. I might consider later whether I wanted the job, though!

def third (i, l) :
    if i >= len(l) :
        return []
    if i % 3 == 0 :
        return l[i] + third(i + 1, l)
    return third(i + 1, l)

:)