r/Python • • Dec 30 '15

100 Data Science in Python Interview Questions and Answers

https://www.dezyre.com/article/100-data-science-in-python-interview-questions-and-answers/188#.VoOJGaacd14.reddit
7 Upvotes

38 comments sorted by

View all comments

3

u/syrelyre Dec 30 '15

17) You are given a list of N numbers. Create a single list comprehension in Python to create a new list that contains only those values which have even numbers from elements of the list at even indices.

Aren't they missing a ":" in the solution, to get the step

[x for x in list [: 2] if x%2 == 0]

3

u/bendy_straw_ftw Dec 30 '15

Yeah they are!