Open In App

Python program to print the dictionary in table format

Last Updated : 06 Sep, 2024
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

Given a Dictionary. The task is to print the dictionary in table format.

Examples:

Input: 
{1: ["Samuel", 21, 'Data Structures'], 
2: ["Richie", 20, 'Machine Learning'], 
3: ["Lauren", 21, 'OOPS with java'], 
}
Output: 
NAME AGE COURSE 
Samuel 21 Data Structures 
Richie 20 Machine Learning 
Lauren 21 OOPS with java 

Method 1: Displaying results by iterating through values. 


Output
NAME       AGE        COURSE    
Samuel     21         Data Structures
Richie     20         Machine Learning
Lauren     21         OOPS with java

Method 2: Displaying by using a matrix format 
 


Output
 NAME   AGE    COURSE 
Samuel   21   Data structures   
Richie   20   Machine Learning   
Lauren   21   OOPS with Java   

Method 3: Displaying by using zip format 


Output
NAME AGE COURSE  
Samuel 21 Data Structures  
Richie 20 Machine Learning  
Lauren 21 OOPS with Java  

Practice Tags :

Similar Reads