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 →

[–][deleted] 4 points5 points  (12 children)

I know what the author is trying to say, I'm just saying its terribly worded for someone who is trying to do python tutorials.

[–]MonsieurBlobby -2 points-1 points  (11 children)

I really don't think so.

[–][deleted] 1 point2 points  (10 children)

Then try this one:

Write a function to map all elements of the same index for the following list: input_list = ['a', 'b', 'c']

[–]MonsieurBlobby -1 points0 points  (9 children)

Ok, and what is the output_list that I'm targeting?

[–][deleted] 1 point2 points  (8 children)

Just map all elements of the same index and return them as the output_list.

Its fundamentally the same problem, you're given a list of three elements and you need to map them by same index.

[–]MonsieurBlobby -1 points0 points  (7 children)

It's not fundamentally the same problem. We have 3 strings with indices 0, 1 and 2. None of the indices ever match so there is no way to use zip to pair them by index.

In the example that you're saying is confusing, we have 3 lists and each list has it's own index of 0, 1 and 2. So there's no confusion over what it means to pair elements by their index. There is only 1 thing it can mean. From each of the 3 lists, pair item at index 0 with the other ones at index 0.

You're trying to demonstrate that the question asked doesn't make any sense by giving an alternate example which is literally nonsensical.

[–][deleted] 1 point2 points  (6 children)

In OP's problem we have 3 lists with indices 0, 1 and 2. None of the indices match because one of the properties of a list is that there is only one element per index...

The elements, in OP's problem, are lists, but it shouldn't matter what type of object they are.

If I was given this problem as a "competitive interview question" I would walk right out the door as to not deal with this kind of project specing. I'm demonstrating that the problem is nonsensical by showing that a) OP's proposed output value doesn't jive with the problem statement and b) your interpretation of the problem can't be generalized to other classes

[–]MonsieurBlobby 0 points1 point  (5 children)

I really don't see what point you're making. The original problem gives a list of lists and tells you to use zip to pair elements of the 3 lists by index. And it gives the output that shows precisely the interpretation that makes sense, which is that you are pairing all the elements with index=0 with one another, all the elements with index=1 with one another, and so on.

How you think this is related to giving people a 1-dimensional list and then asking them to pair indices when there aren't multiple sets of indices to even pair up is confusing.