-
Notifications
You must be signed in to change notification settings - Fork 0
/
printer.py
29 lines (24 loc) · 1.22 KB
/
printer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# ###################################################### #
# #
# COPYRIGHT BLOCK. DO NOT REMOVE #
# #
# Filename | 'printer.py' #
# Created | 27.12.2022 #
# Description | The functions in printer.py can be used #
# to display a matrix, dictionary, etc. in #
# proper format. #
# #
# This file and its contents are intellectual properties #
# of Mohammad Yasir and unauthorized usage, or usage #
# without proper credit to the author may lead to legal #
# consequences. #
# #
# ###################################################### #
from tabulate import tabulate
# Helper method to print a dictionary in tabular format.
def printDictionary(dictionary):
for key, value in dictionary.items():
print("{0}\t|\t{1}".format(key, value))
#A helper method to print a 2D matrix
def print2DMatrix(matrix):
print(tabulate(matrix))