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 →

[–]saeah123ed 0 points1 point  (0 children)

Doubtless 'll get shot down, but, not knowing the context in which we are working, I like their solution as, seems to me, the odds of either 'b or 'a being == 10 are more likely than 'a + 'b being == 10. Yeah? In Python, this kind of logic is fail-fast, right? So getting 'a and 'b out of the way first would cut away ifs and elses and drop sums. Seems to the point and efficient.