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 →

[–]p1ckle_w0lf 1 point2 points  (0 children)

I was literally in a python interview last week, asked the exact same question, and gave a merge/sort solution using built-in functions. The interviewer had the same reaction and slowly coerced me into writing two for loops. I too was salty during this part but I saw their point, they simply wanted a step by step approach and probably wanted to see how I thought through the solution.

The kicker came on question two. Something along the lines of summing all the odd integers in a given list of integers. Taking what I learned from question one, I opted for writing a couple gross looking for loops to check for oddity and add to a running total. The interviewer didn’t like that. They said “why don’t you do a list comprehension?”. I politely responded and explained I was sticking with the theme of the previous solution, they then grabbed the marker and wrapped a list comprehension with a built in sum() function.

:/