Python: Extract values from a given dictionaries and create a list of lists from those values
62. Extract Values from Dictionary and Create a List of Lists
Write a Python program to extract values from a given dictionary and create a list of lists from those values.
Visual Presentation:

Sample Solution:
Python Code:
Sample Output:
Original Dictionary: [{'student_id': 1, 'name': 'Jean Castro', 'class': 'V'}, {'student_id': 2, 'name': 'Lula Powell', 'class': 'V'}, {'student_id': 3, 'name': 'Brian Howell', 'class': 'VI'}, {'student_id': 4, 'name': 'Lynne Foster', 'class': 'VI'}, {'student_id': 5, 'name': 'Zachary Simon', 'class': 'VII'}] Extract values from the said dictionarie and create a list of lists using those values: [[1, 'Jean Castro', 'V'], [2, 'Lula Powell', 'V'], [3, 'Brian Howell', 'VI'], [4, 'Lynne Foster', 'VI'], [5, 'Zachary Simon', 'VII']] [[1, 'Jean Castro'], [2, 'Lula Powell'], [3, 'Brian Howell'], [4, 'Lynne Foster'], [5, 'Zachary Simon']] [['Jean Castro', 'V'], ['Lula Powell', 'V'], ['Brian Howell', 'VI'], ['Lynne Foster', 'VI'], ['Zachary Simon', 'VII']]
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to extract the values from a dictionary and return them as a list of lists using list().
- Write a Python program to iterate over a dictionary and collect its values into a nested list structure.
- Write a Python program to use dictionary.values() and convert the resulting view into a list of lists.
- Write a Python program to implement a function that returns all dictionary values as separate lists within one list.
Go to:
Previous: Write a Python program to count the frequency in a given dictionary.
Next: Write a Python program to convert a given list of lists to a dictionary.
Python Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.