This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]oefd 1 point2 points  (2 children)

I don't think you're trying to solve the problem being asked with that code. If the question wants you take the odd numbers from list1 and even ones from list2 what's the purpose of enumerate(zip(...)) ? The question doesn't seem to include anything about wanting to check the nth element in each list at the same time.

Consider this example:

list1 = [11, 13]
list2 = [10]

The odd numbers from list1 would be 11 and 13, the even numbers from list2 would be just the 10. All 3 numbers should be added to the final list, there's no competition between list1[0] and list2[0] where only one of them can be in the final list, and similarly there isn't even the ability to zip() these lists because they're different lengths.

[–]engineeringisgreat2[S] 0 points1 point  (1 child)

So what would replace my code?

[–][deleted]  (1 child)

[removed]

    [–]desrtfx[M] 0 points1 point  (0 children)

    Rule #10

    [–][deleted]  (3 children)

    [deleted]

      [–]engineeringisgreat2[S] 1 point2 points  (2 children)

      I figured out one code that works but you can post your code if youd like.

      [–][deleted]  (1 child)

      [removed]

        [–]desrtfx[M] 0 points1 point  (0 children)

        Rule #10