Python: Extract every first or specified element from a given two-dimensional list
Extract Specified Element from 2D List
Write a Python program to extract every first or specified element from a given two-dimensional list.
Sample Solution:
Python Code:
Sample Output:
Original list of lists: [[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]] Extract every first element from the said given two dimensional list: [1, 4, 7] Extract every third element from the said given two dimensional list: [3, 6, 9]
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to extract every second element from each row of a given two-dimensional list.
- Write a Python program to extract elements from a 2D list based on a given index list.
- Write a Python program to extract elements diagonally from a square 2D list.
- Write a Python program to extract every element except the first and last columns from a 2D list.
Python Code Editor:
Previous: Write a Python program to get the frequency of the elements in a given list of lists.
Next: Write a Python program to generate a number in a specified range except some specific numbers.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics