Python - List consisting of all the alternate elements Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report We are given a list consisting we need to get all alternate elements of that list. For example, we are given a list a = [1, 2, 3, 4, 5, 6, 7, 8] we need to get all alternate elements of that list so that output should be [1, 3, 5, 7].Using List SlicingList slicing allows us to select every alternate element by specifying a step of 2 in the slice notation. This creates a new list with elements at even or odd indices depending on starting index. Python a = [1, 2, 3, 4, 5, 6, 7, 8] # Use slicing to get every second element starting from index 0 res = a[::2] print(res) Output[1, 3, 5, 7] Explanation:Slice notation a[::2] selects every second element from list a starting from index 0.Result is a new list res containing alternate elementsUsing List ComprehensionList comprehension allows us to iterate through list and select every alternate element by checking if index is even results in a new list containing filtered elements. Python a = [1, 2, 3, 4, 5, 6, 7, 8] # List comprehension to pick alternate elements res = [a[i] for i in range(len(a)) if i % 2 == 0] print(res) Output[1, 3, 5, 7] Explanation:List comprehension iterates through indices of list a checking if index is even (i % 2 == 0).For each even index corresponding element is added to list res resulting in alternate elements.Using filter() and lambdafilter() function with a lambda function checks if index of each element is even using enumerate() to access both index and value result is an iterator containing only elements at even indices which can be converted to a list. Python a = [1, 2, 3, 4, 5, 6, 7, 8] # Use filter with lambda to select alternate elements res = list(filter(lambda x: a.index(x) % 2 == 0, a)) print(res) Output[1, 3, 5, 7] Explanation:filter() function uses a lambda to check if the index of each element in the list a is even by using a.index(x) % 2 == 0.filter() returns an iterator which is converted to a list res containing the alternate elements. Comment More infoAdvertise with us Next Article Python - Repeat Alternate Elements in list M manjeet_04 Follow Improve Article Tags : Python Python Programs Python list-programs Practice Tags : python Similar Reads Python - Repeat Alternate Elements in list Many times we have this particular use-case in which we need to repeat alternate element of list K times. The problems of making a double clone has been discussed but this problem extends to allow a flexible variable to define the number of times the element has to be repeated. Letâs discuss certain 7 min read Python - Alternate list elements as key-value pairs Given a list, convert it into dictionary by mapping alternate elements as key-value pairs. Input : test_list = [2, 3, 5, 6, 7, 8] Output : {3: 6, 6: 8, 2: 5, 5: 7} Explanation : Alternate elements mapped to get key-value pairs. 3 -> 6 [ alternate] Input : test_list = [2, 3, 5, 6] Output : {3: 6, 2 min read Python | Maximize alternate element List The problem of getting maximum of a list is quite generic and we might some day face the issue of getting the maximum of alternate elements and get the list of 2 elements containing maximum of alternate elements. Letâs discuss certain ways in which this can be performed. Method #1 : Using list compr 3 min read Python | Alternate element summation in list The problem of getting summation of a list is quite generic and we might some day face the issue of getting the summation of alternate elements and get the list of 2 elements containing summation of alternate elements. Let's discuss certain ways in which this can be performed. Method #1 : Using list 5 min read Python - Alternate Minimum element in list Some of the list operations are quite general and having shorthands without needing to formulate a multiline code is always required. Wanting to construct the list consisting of all the alternate elements of the original list is a problem that one developer faces in day-day applications and sometime 4 min read Python - Alternate Elements operation on Tuple Sometimes, while working with Python Tuples, we can have problem in which we need to perform operations of extracted alternate chains of tuples. This kind of operation can have application in many domains such as web development. Lets discuss certain ways in which this task can be performed. Input : 5 min read Like