In: Computer Science
Write a module for importing the data that includes the following functions:
Short Summary:
**************Please upvote the answer and appreciate our time.************
Source Code:
import numpy as np
# function table_print
def table_print():
# headre name in a list
teams_list = ["HeaderText", "HeaderText"]
# data as an array
data = np.array([['D1','D2'],
['D4','D5']])
# formatting till the length of the header
row_format ="{:>15}" * (len(teams_list) + 1)
# printing the list
print(row_format.format("", *teams_list))
# iterate through the header and data
for team, row in zip(teams_list, data):
# printing the result
print(row_format.format(team, *row))
# calling the function
table_print()
Refer the following screenshots for code indentation:
Sample Run:
**************************************************************************************
Feel free to rate the answer and comment your questions, if you have any.
Please upvote the answer and appreciate our time.
Happy Studying!!!
**************************************************************************************