Skip to content

Comment on Python Multiple Assignment Is a Puzzleparent

Comments

Just wanted to add a more functional solution:

    def miss_pos(a):
        b = range(1, len(a)+2)
        return min(set(b).difference(a))
It's probably not as efficient, but remember the first rule of optimization: http://c2.com/cgi/wiki?FirstRuleOfOptimization

I wonder why so much discussion about arbitrary rules of assignment when the solution to the problem can be written (and is more readable) without ever mentioning this complicated "assignment" feature.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.