FAQ: Code Challenge: Loops - Reversed List

A post was split to a new topic: Code challenge bug [solved]

5 posts were split to a new topic: Return will end a function and stop any loops

25 posts were merged into an existing topic: Return will end a function and stop any loops

6 posts were merged into an existing topic: How can I iterate over a list backward?

4 posts were split to a new topic: Could I just use reverse()?

2 posts were split to a new topic: My solution

7 posts were split to a new topic: What does lst2[len(lst2) - 1 - index] do?

3 posts were split to a new topic: Can I solve this with a reverse slice?

3 posts were split to a new topic: Could I make a list determining if they match?

A post was split to a new topic: This is my solution

And now for a spot of silliness…

>>> a = [3, 5, 7]
>>> b = [8, 5, 3]
>>> c = zip(a, b[::-1])
>>> d = map(lambda x: set(x), c)
>>> e = filter(lambda x: len(x) != 1, list(d))
>>> list(e)
[{8, 7}]
>>> a = [3, 5, 7]
>>> b = [7, 5, 3]
>>> c = zip(a, b[::-1])
>>> d = map(lambda x: set(x), c)
>>> e = filter(lambda x: len(x) != 1, list(d))
>>> list(e)
[]
>>> 
1 Like

3 posts were merged into an existing topic: Sharing solutions

5 posts were merged into an existing topic: What does lst2[len(lst2) - 1 - index] do?

8 posts were split to a new topic: Could I solve this using reverse()? Is it efficient?

3 posts were merged into an existing topic: Sharing solutions

2 posts were split to a new topic: Why doesn’t this code work?

4 posts were split to a new topic: Is this code okay?

3 posts were merged into an existing topic: How can I iterate over a list backward?

2 posts were merged into an existing topic: Sharing solutions

2 posts were split to a new topic: What do you think of this solution?